<input type="radio" name="a" value="0" onclick="if(this.checked) document.getElementById('b').style.display='';" checked>显示
<input type="radio" name="a" value="1" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="2" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="3" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<div id="b"><input><input><input></div>document.getElementById('xxx')用来获取id为xxx的对象。
style表示对象的样式
display表示显示的方式,其取值为空时表示显示,取none表示不显示
<input type="radio" name="a" value="1" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="2" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="3" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<div id="b"><input><input><input></div>document.getElementById('xxx')用来获取id为xxx的对象。
style表示对象的样式
display表示显示的方式,其取值为空时表示显示,取none表示不显示
<input type="radio" name="a" value="1" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="2" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="3" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<div id="b"><input><input><input></div>******************以上是写在form里面吗?
那要插入的text框那?
如果是在form里,可以用name引用。不放在form里就像上面的例子一样用id引用。
<form>
<table width="99%" border="0" cellspacing="0" cellpadding="0" class="box">
<tr>
<td class=form_th colspan=2>订单</td>
</tr>
<tr></tr><tr></tr>
<tr>
<th><span class="box_th">类型</span></th>
<input type="radio" name="a" value="0" onclick="if(this.checked) document.getElementById('b').style.display='';" checked>显示
<input type="radio" name="a" value="1" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="2" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
<input type="radio" name="a" value="3" onclick="if(this.checked) document.getElementById('b').style.display='none';">不显示
</tr>
<div id="b">
地址1:<input type="text" name="add1" value="上海" />
地址2:<input type="text" name="add1" value="北京" />
地址3:<input type="text" name="add1" value="武汉" />
</div>
</table>
</form>
</body>
<div id="b">
地址1:<input type="text" name="add1" value="上海" />
地址2:<input type="text" name="add1" value="北京" />
地址3:<input type="text" name="add1" value="武汉" />
</div>
改成:
<tr id="b"><td>
地址1:<input type="text" name="add1" value="上海" />
地址2:<input type="text" name="add1" value="北京" />
地址3:<input type="text" name="add1" value="武汉" />
</td></tr>