日期:2014-05-17  浏览次数:20876 次

高手来看看取值问题
用什么方式来把上一个下拉列表框a改变值获得后传到textbox里去执行后,把值读取到下一个下拉列表框b里去呢,

------解决方案--------------------
<form name= "form1 " action= " " method= "post ">
<select name= "sel_a " onChange= "Change(); ">
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
</select>
<input name= "txt " type= "text ">
</form>
<script language= "javascript ">
function Change()
{
document.form1.txt.value=document.form1.sel_a.value;
}
</script>
------解决方案--------------------
<form name= "form1 " action= " " method= "post ">
<select name= "sel_a " onChange= "Change(); ">
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
</select>
<input name= "txt " type= "text ">
<input name= "button " type= "button " value= "执行 " onclick= "Click(); ">
<select name= "sel_b ">
<option value= " "> 选择 </option>
</select>
</form>
<script language= "javascript ">
function Change()
{
document.form1.txt.value=document.form1.sel_a.value;
}
function Click()
{
if(document.form1.txt.value != " ")
{
var temp = document.form1.sel_b;
var sel_len = document.form1.sel_b.options.length;
temp.options[sel_len]=new Option(document.form1.txt.value,document.form1.txt.value);
}
}
</script>

OK了,另存为.html测试是不是你想要的结果,结贴!