[求助]下拉菜单给文本框赋值求教.
<SCRIPT LANGUAGE="JavaScript">
function gd()
{
document.getElementsByName("s2")[0].value = document.getElementsByName("S1")[0].options[document.getElementsByName("S1")[0].selectedIndex].text;
}
</SCRIPT>
<select size="1" name="S1" onChange=gd()>
<option value="a1" selected>A1选项</option>
<option value="a2">b2选项</option>
<option value="a3">b3选项</option>
<option value="a4">b4选项</option>
</select>
<input type=text name="s2">
function gd()
{
document.getElementsByName("s2")[0].value = document.getElementsByName("S1")[0].options[document.getElementsByName("S1")[0].selectedIndex].text;
}
</SCRIPT>
<select size="1" name="S1" onChange=gd()>
<option value="a1" selected>A1选项</option>
<option value="a2">b2选项</option>
<option value="a3">b3选项</option>
<option value="a4">b4选项</option>
</select>
<input type=text name="s2">
能否在不选择的情况下,文本自动获取下拉菜单的默认值..谢谢.
[此贴子已经被作者于2007-2-28 18:00:58编辑过]