<form name="add">
<table >
 <tr><td align="right">选择地址</td>
               <td><label>
                 <input name="check_add" type="radio" id="radio"  onclick="showadv()" value="d1" checked="checked"/>
                 实体店
                 <input type="radio" name="check_add" id="radio" value="d2" />
               网店</label></td>
             </tr>
        <tr id=realadd>
          <td  align="right">实体店地址</td>
          <td>
          <input name="other[office_phone]" size="25" type="text" class="inputBg"/>
          <span style="color:#FF0000">*</span></td>
        </tr>
        </div>
         <tr id=webadd style="display:none;">
           <td align="right">网店网址</td>
           <td><input name="other[office_phone2]" type="text" class="inputBg" id="other[office_phone2]" size="25"/>
           <span style="color:#FF0000">*</span></td>
         </tr>
</table>
</form>radio checked后 实现选实体店 显示实体店地址这个input  选网店显示网店网址 这个input

解决方案 »

  1.   

    <form name="add">
    <table >
     <tr><td align="right">选择地址</td>
                   <td><label>
                     <input name="check_add" type="radio" id="radio1"  onclick="showadv()" value="d1" checked="checked" />
                     实体店
                     <input type="radio" name="check_add" id="radio2"  onclick="showadv()" value="d2" />
                   网店</label></td>
      </tr>
            <tr id=realadd>
              <td  align="right">实体店地址</td>
              <td>
              <input name="other[office_phone]" size="25" type="text" class="inputBg"/>
              <span style="color:#FF0000">*</span></td>
            </tr>
            
             <tr id=webadd style="display:none;">
               <td align="right">网店网址</td>
               <td><input name="other[office_phone2]" type="text" class="inputBg" id="other[office_phone2]" size="25"/>
               <span style="color:#FF0000">*</span></td>
             </tr>
    </table>
    </form>
    <script>
    var showadv=function(){
    if(document.getElementById("radio1").checked!=true)
    {
    document.getElementById("realadd").style.display="none";
    document.getElementById("webadd").style.display="block";
    }else
    {
    document.getElementById("realadd").style.display="block";
    document.getElementById("webadd").style.display="none";
    }
    };
    </script>
      

  2.   

    非常感谢xiaojing7 的,可以实现谢谢。