javascript:将下拉列表中选中的值赋给一个文本框
<html><head><title></title></head><body><scriptlanguage="javascript">document.write("...
<html>
<head>
<title></title>
</head>
<body>
<script language="javascript">
document.write("<HR>");
document.write("<H3>select box</H3>");
document.write("<HR>");
document.write("<Form name ='SELECTFORM'>");
document.write("<SELECT NAME='Machine' onChange='this.Form.Result.value=this.options[this.selectedIndex].value;this.selectedIndex=0;'>");
document.write('<option value="" SELECTED>(一览)');
document.write('<option value="DOS/V" SELECTED>DOS/V');
document.write('<option value="Mac" SELECTED>Mac');
document.write('<option value="UNIX" SELECTED>UNIX');
document.write("</select>");
document.write("<input type='text' name='Result' size=20><br>");
document.write("</form>");
document.write("<hr>");
</script>
</body>
</html>
问题:运行时无法实现赋值给文本框,不知道哪里出错了! 展开
<head>
<title></title>
</head>
<body>
<script language="javascript">
document.write("<HR>");
document.write("<H3>select box</H3>");
document.write("<HR>");
document.write("<Form name ='SELECTFORM'>");
document.write("<SELECT NAME='Machine' onChange='this.Form.Result.value=this.options[this.selectedIndex].value;this.selectedIndex=0;'>");
document.write('<option value="" SELECTED>(一览)');
document.write('<option value="DOS/V" SELECTED>DOS/V');
document.write('<option value="Mac" SELECTED>Mac');
document.write('<option value="UNIX" SELECTED>UNIX');
document.write("</select>");
document.write("<input type='text' name='Result' size=20><br>");
document.write("</form>");
document.write("<hr>");
</script>
</body>
</html>
问题:运行时无法实现赋值给文本框,不知道哪里出错了! 展开
展开全部
<!DOCTYPE html>
<html>
<head>
<title>
dd
</title>
</head>
<body>
<script language="javascript">
document.write("<HR>");
document.write("<H3>select box</H3>");
document.write("<HR>");
document.write("<form name ='SELECTFORM'>");
document.write("<SELECT NAME='Machine' onChange='this.form.Result.value=this.value;this.selectedIndex=0;'>");
document.write('<option value="">(一览)</option>');
document.write('<option value="察慧乱DOS/V">DOS/V</option>');
document.write('<option value="Mac">Mac</option>');
document.write('<碧粗option value="UNIX">UNIX</option>');
document.write("</SELECT>");
document.write("<input type='text' name='Result' size=20><br>");
document.write("</form>");
document.write("败档<hr>");
</script>
</body>
</html>
追问
我想问一下this.selectedIndex=0是起什么作用的?多谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询