我有一个下拉列表,其中有其他选项,当选择其他选项时出现一个新的字段,我们可以输入文本指定其他,BUt文本填充时我没有得到填补了该领域的数据我只得到其他在下拉字段中插入的文本没有反映
HTML:
<html>
<head>
<script type="text/javascript">
function showfield(name){
if(name=='Other')document.getElementById('div1').innerHTML='Other: <input type="text" name="other" />';
else document.getElementById('div1').innerHTML='';
}
</script>
</head>
<body>
<select name="drop" id="drop" onchange="showfield(this.options[this.selectedIndex].value)">
<option selected="selected">Please select ...</option>
<option value="car">car</option>
<option value="bike">bike</option>
<option value="Other">Other</option>
</select>
<div id="div1"></div>
</body>
</html>
而如何把一个帮助文本,当我们插入时,另一个是即将到来的新的文本框里面的数据将消失选择。
在此先感谢。
使用jQuery是这样的事情更容易为工作 – RRR