form2.selectbox.options[form2.selectbox.selectedIndex].value

解决方案 »

  1.   

    opener.document.all("selectbox").options[document.all("selectbox").selectedIndex].value
      

  2.   

    首先给你的<option>加上value属性:
    <select name="selectbox">
    <option value=xxxx>xxxx</option>
    </select>
    其次,如果要得到form里面的数据,需要用提交的方法:
    <input type="text" name="name"><input type="button" value="select" onclick="form2.action='b.jsp';form2.target="_new";form2.submit()">
      

  3.   

    <script>
    function NewWin()
    {
       var sValue=form2.selectbox.value;
       window.open('b.jsp?sValue='+sValue,'','width=600,height=400')
    }
    </script>
    <html>
    <body>
    <FORM METHOD=POST name="form2">
    <select name="selectbox">
    <option >xxxx</option>
    </select>
    <input type="text" name="name"><input type="button" value="select" onclick="NewWin()">
     </FORM>
    </body>
    </html>
      

  4.   

    都不明白我的意思,我的按鈕打開b.jsp后選擇radio,它前面的name文本框顯示它的value
      

  5.   

    <p><input type="text" name="T1" size="20"><input type="radio" value="V1" 
    checked name="R1" onclick="T1.value=value"></p>
      

  6.   

    說什么呢?不明白我的意思! 我的意思是第一個下拉框先一個value,然后后面的按鈕打開b.jsp窗口,根據下拉框的value,篩選 一些數據,然后選擇,確定后,下拉框的后面,即name文本框顯示剛才選的value,大家是否明白??
      

  7.   

    不要用name这样的关键字做元素的名字!
      

  8.   

    <FORM METHOD=POST name="form2">
    <select name="selectbox">
    <option >xxxx</option>
    </select>
    <input type="text" name="userName">
    <input type="button" value="select" onclick="window.form2.userName.value=showModalDialog('b.html','','dialogHeight:400px;dialogWidth:600px')">
     </FORM>
    -----------------------------------------------
    b.html:
    -----------------------------------------------
    <html>
    <head>
    <title>emu</title>
    </head>
    <body>
    <button onclick="window.returnValue='asdf';window.close()">return</button>
    </body>
    </html>
    ----------------------------------------------------------------
      

  9.   

    把参数传递给b的例子:<FORM METHOD=POST name="form2">
    <select name="selectbox">
    <option value="asdf">test1</option>
    <option value="1234">test2</option>
    <option value="5678">test3</option>
    </select>
    <input type="text" name="userName">
    <input type="button" value="select" onclick="window.form2.userName.value=showModalDialog('b.html',window.document.form2.selectbox.value,'dialogHeight:400px;dialogWidth:600px')">
     </FORM>b.html:(其实只是把传过来的参数传回去)
    ----------------------------------------------------------
    <html>
    <head>
    <title>emu</title>
    </head>
    <body>
    <button onclick="window.returnValue=window.dialogArguments;window.close()">return</button>
    </body>
    </html>
    ----------------------------------------------------------
      

  10.   

    真的在线等吗?又不帮我up一下,害我又用马甲。如果要在服务器端获得参数参考下面的:<FORM METHOD=POST name="form2">
    <select name="selectbox">
    <option value="asdf">test1</option>
    <option value="1234">test2</option>
    <option value="5678">test3</option>
    </select>
    <input type="text" name="userName">
    <input type="button" value="select" onclick="window.form2.userName.value=showModalDialog('b.jsp?selectbox='+document.form2.selectbox.value,window.document.form2.selectbox.value,'dialogHeight:400px;dialogWidth:600px')">
     </FORM>b.jsp:
    ------------------------------------------------------------
    <html>
    <head>
    <title>emu</title>
    </head>
    <body>
    <button onclick="window.returnValue='<%=request.getParameter("selectbox")%>';window.close()">return</button>
    </body>
    </html>
    ------------------------------------------------------------
      

  11.   

    <input type="button" value="select" onclick="window.form2.userName.value=showModalDialog('b.jsp?selectbox='+document.form2.selectbox.value,'','dialogHeight:400px;dialogWidth:600px')">呵呵,刚才多拷贝了份window.document.form2.selectbox.value了,虽然也没错......