改正下我的错误代码 ,谢谢
oView.innerText=document.all( "oSelect1 ").options[selectedIndex].value;
其中oView是个DIV
oSelect1是个下拉框
提示错误 没有selectedIndex的定义
------解决方案--------------------oView.innerText=document.all.oSelect1.options[selectedIndex].value;
------解决方案--------------------下拉框的value就是其选中的option的value...
------解决方案--------------------oView.innerText=document.all.oSelect1.options[selectedIndex].value;
selectedIndex为数值就012345……
------解决方案--------------------实在要写的话
oView.innerText=document.all.oSelect1.options[document.all.oSelect1.selectedIndex].value;
------解决方案-------------------- <body>
<form>
<select id= "oSelect1 " onchange= "document.all.oView.value=this.options[this.selectedIndex].value ">
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
</select>
<input type= "text " id= "oView " value= " ">
</form>