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

将下拉框的值传给文本框
如题,我有一个下拉框和一个文本框,如何将下拉框的值传到文本框,选择一次下拉框就传一个值,选几次累加传几个,但不允许重复,如何实现啊,注意是多个值

------解决方案--------------------
<html>

<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 1 </title>
</head>

<body>
<script language= "javascript ">
function a()
{
if(f.t.value.indexOf(f.d.options[f.d.selectedIndex].value)==-1)
{
f.t.value+=f.d.options[f.d.selectedIndex].value;
}
}
</script>
<form method= "POST " action= "--WEBBOT-SELF-- " name= "f ">
<p> <select size= "1 " name= "d " onchange= "a() ">
<option selected value= "111111111111 "> 111111111111 </option>
<option value= "222222222222 "> 222222222222 </option>
<option value= "333333333333333 "> 333333333333333 </option>
</select> </p>
<p> <input type= "text " name= "t " size= "59 "> </p>
<p> <input type= "submit " value= "提交 " name= "B1 "> <input type= "reset " value= "重置 " name= "B2 "> </p>
</form>

</body>

</html>