window.open("url?id="+参数变量,"","top=0,left=380,height=444,width=400,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");

解决方案 »

  1.   

    在弹出的窗口中取值:
    request.getParameter("id");
      

  2.   

    lci21(流浪少年)说得对,不过在url中要包含那个JSP文件。
      

  3.   

    给你句个例子吧,从页面1连到2.jsp,在2.jsp中获得1中的值
    1.jsp程序如下:
    <html>
    <head>
    <title></title>
    </head>
    <script language="javascript">
    function winopen(x)
    {
          window.open("2.jsp?id="+x,"","top=0,left=380,height=444,width=400,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
    }
    </script>
    <body>
    <%
    int a[] = {1,2,3,4,5};
    %>
    <%
    for (int i=0;i<5;i++)
    {
    %>
    <a href="javascript:winopen(<%=a[i]%>)">连接<%=i%></a><br><br>
    <%}%>
    </body>
    </html>2.jsp程序如下:
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <%
    String b = request.getParameter("id");
    %>
    本页是2.jsp,从1.jsp获得的值为:<%=b%>
    </body>
    </html>
      

  4.   

    您这样是可以的,但是我想获取表单的值呀,即选ABCD,这个值该怎么传?document.form.xxx.value应该怎么写?
      

  5.   

    faint
    表单的值不是同样的道理吗?呵呵~~~
      

  6.   

    <input type=button value="投票" onclick="check()">
    function check()
    {
       document.yourformname.action = newwindow;
       document.yourformname.target = _blank;
       document.yourformname.submit();
    }
    第二页:
    String strvalue = request.getParameter("variable");
    that'all ok?
      

  7.   

    to lci21(流浪少年):好人做到底吧?再给我个例子?它老是提示说"document.vote.dc.value"不是对象的错误。to whd11808(小玉米):这个窗口能定制吗?固定位置和大小
      

  8.   

    1.jsp:
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <script language="javascript">
    function winopen(x)
    {
    alert(x);
    window.open("2.jsp?id="+x,"","top=0,left=380,height=444,width=400,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
    }
    </script>
    </head><body><form name="vote" method="POST" onsubmit="return winopen(window.document.vote.R1.value)">
       <p><input type="radio" value="1" name="R1"><input type="radio" value="2" name="R1"><input type="radio" value="3" name="R1"><input type="radio" value="4" name="R1"><input type="radio" value="5" checked name="R1"></p>
      <p><input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2"></p>
    </form></body></html>2.jsp:

    为何得到是undefined呢?
      

  9.   

    2.jsp不变,
    1.jsp如下:
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <script language="javascript">
    <!--
    function winopen()
    {
          var x=document.vote.R1.value;
          for (i=0;i<document.vote.R1.length;i++)
          {
             if (document.vote.R1[i].checked==true)
             {
              x=document.vote.R1[i].value;
              break;
              }
          }
          window.open("2.jsp?id="+x,"","top=0,left=380,height=444,width=400,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=yes");
    }
    -->
    </script>
    </head><body>
    请选择:<br>
    <form name="vote" method="post">
      <p>
      <input type="radio" value="1" name="R1">选项1
      <input type="radio" value="2" name="R1">选项2
      <input type="radio" value="3" name="R1">选项3
      <input type="radio" value="4" name="R1">选项4
      <input type="radio" value="5" name="R1" checked>选项5
      </p>
      <p>
      <input type="button" value="提交" onclick="winopen()">
      <input type="reset" value="全部重写" name="B2"></p>
    </form></body></html>