当前位置: 代码迷 >> ASP >> 高手来看看取值有关问题
  详细解决方案

高手来看看取值有关问题

热度:91   发布时间:2012-03-09 16:54:56.0
高手来看看取值问题
用什么方式来把上一个下拉列表框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测试是不是你想要的结果,结贴!
  相关解决方案