页面设计中使用Struts的select,如何使用JS得到html:select的选择值 ?页面设计代码如下。谢谢 <body> 
    <br>数据上传<br>
    <html:form action="/deployData">
请选择上传文件数量:
<html:select property="number" onchange="buildFileInput()">
<html:option value='1'>1</html:option>
           <html:option value='2'>2</html:option>
           <html:option value='3'>3</html:option>
           <html:option value='4'>4</html:option>
        </html:select>
<table width="200" border="0">
           <tr>
             <td><br>
             <div id="files"></div>
<html:submit value="提交"/>
   <html:cancel value="取消"/><br></td>
           </tr>
        </table> 
</html:form> 
  </body>

解决方案 »

  1.   

        <br>数据上传 <br> 
        <form action="/deployData"> 
    请选择上传文件数量: 
    <select property="number" onchange="buildFileInput(this)"> 
    <option value=1>1 </html:option> 
    <option value=2>2 </html:option> 
    <option value=3>3 </html:option> 
    <option value=4>4 </html:option> 
    </select> 
    <table width="200" border="0"> 
              <tr> 
                <td> <br> 
                <div id="files"></div> 
    <input type=submit value="提交"/> 
    <input type=reset value="取消"/> <br> </td> 
              </tr> 
            </table> 
    <form>
    <script language="javascript">
    <!--
    function buildFileInput(obj){
    document.getElementById("files").innerHTML=''
    for (var i=0;i<obj.value;i++)
    document.getElementById("files").innerHTML+='<input id="files"'+i+' type=file><br>'
    }//-->
    </script>
      

  2.   

    不知道楼上的意思。我想使用JS得到Struts的html:select的选择值。哪位高人来段完整的代码。感谢感谢
      

  3.   

    obj.value = select的选择值
      

  4.   


    ...
    <html:select property="number" name="abc" onchange="buildFileInput()"> 
    <html:option value='1'>1 </html:option> 
              <html:option value='2'>2 </html:option> 
              <html:option value='3'>3 </html:option> 
              <html:option value='4'>4 </html:option> 
            </html:select> ...
    function buildFileInput(){
      var selectedValue = document.getElementById("abc").value;
      alert(selectedValue);
    }
      

  5.   

     var objSelect=document.getElementById("path1");
          var selectedValue =objSelect.options[objSelect.selectedIndex].text;