xiaoyaoyou - 2009-11-3 19:19:31
<html>
<script>
function showTextbox(value,textboxid)
{
if(value==0)
{
document.getElementById(textboxid).style.display="block";
}
else
{
document.getElementById(textboxid).style.display="none";
}
}
</script>
单选框:<br/>
<input type=radio value=1 name=a onclick="showTextbox(1,'textbox1')"/>选项一
<input type=radio value=2 name=a onclick="showTextbox(2,'textbox1')" />选项一
<input type=radio value=3 name=a onclick="showTextbox(3,'textbox1')" />选项一
<input type=radio value=4 name=a onclick="showTextbox(4,'textbox1')" />选项一
<input type=radio value=0 name=a onclick="showTextbox(0,'textbox1')" />其它(选中此项显示文本
框)<br/>
文本框一:<input type=text id='textbox1' style="display:none;">
<br/><br/>
复选框:<br/>
<input type=checkbox onclick="if(this.checked){showTextbox(0,'textbox2')}else{showTextbox
(1,'textbox2')}">选中则显示文本框
<br/>
文本框二:<input type=text id='textbox2' style="display:none;">
</html>