如何通过ONCHANGE实现选择下拉框不同的值在文本框中适时出现?

如题!

 1<form action="where.asp" method="post" name="form1">
 2<select name="sear" onchange="sel()">
 3<option selected="" value="nbr">业务编号</option>
 4<option value="useid1">客户名称</option>
 5<option value="sertype">业务类型</option>
 6<option value="strtime">业务登记时间</option>
 7<option value="endtimen">业务完成时间</option>
 8<option value="pri">业务等级</option>
 9<option value="sername">客户经理</option>
10<textarea cols="100" name="where1" rows="5"></textarea>
11</select></form>

---------------------------------------------------------------

function sel() {
document.form1.where1.value = document.form1.sear.options[document.form1.sear.selectedIndex].value;
}

若需显示多次的选择,document.form1.where1.value = ... 改为
document.form1.where1.value += "," + ...
其中","为分隔符,按需要选择

Published At
Categories with Web编程
Tagged with
comments powered by Disqus