[求助]下拉菜单和文本框的联动怎样实现?
下拉菜单有两个选项,选A时不显示文本框,选B时显示文本框,请问怎么做?
请教版主,为什么我把下拉菜单和文本框套上<form>之后效果就没了呢?说'this.SelTest.selectedIndex' 为空或不是对象
<html>
<head>
</head>
<script language="javascript" >
function SelTest_Change()
{
var SelIdx=this.SelTest.selectedIndex;
var selOpt=this.SelTest.options[SelIdx];
switch(selOpt.value)
{
case "A":
this.ShowText.style.display="none";
break;
case "B":
this.ShowText.style.display="inline";
break;
}
}
</script>
<body>
<form name="form1" method="post" action="lian.asp">
<select name="SelTest" onChange="SelTest_Change();" >
<option selected >请选择</option>
<option value="A">A</option>
<option value="B">B</option>
</select>
<div id="ShowText" style="display:none" ><input type="text" name="TxtTest" ></div>
</form>
</body>
</html>
[此贴子已经被作者于2007-5-28 10:20:09编辑过]