js怎么实现页面之间的传值??

解决方案 »

  1.   

    不是父子关系的页面只能通过cookie
    在A页面用js拼接一段URL传递到B页面
      

  2.   

    可以在URL后面代上参数.在另一个页面获取此参数就可以了.
      

  3.   

    页面之间不无法通过JS传递参数的,因为JS属性客户端执行的语言,如果想传递参数只能通过URL后面加参数,再通过JSP(或者ASP.NET)等服务器端语言获取,然后传递给JS访法
      

  4.   

    补充3楼的,要是父子关系页面的话可以进行传值(像是父页面: var temp = showModalDialog(...),子页面: window.returnValue=a.就是把a传值给temp了)
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
        function OpenWin()
        {
          window.open("father.htm","aa","","");
        }
        </script>
    </head>
    <body>
        <input id="T1" type="text" />
        <input id="Button1" type="button" value="提交" onclick="OpenWin();" />
    </body>
    </html>
      

  6.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
        function ReturnVal()
        {
          window.opener.document.getElementById('T1').value=document.getElementById('Text1').value;
          window.close();
        }
        </script>
    </head>
    <body>
        <input id="Text1" type="text" />
        <input id="Button1" type="button" value="关闭" onclick="ReturnVal();" />
    </body>
    </html>
      

  7.   

    再发个例子在页面A传值:   
      
    window.showModalDialog("ModalDialogFrame.aspx?Title=选择组织部门&PageUrl=ParentTreeView.aspx",window,"dialogWidth=380px;dialogHeight=650px;status=no;center=yes;");  
      

  8.   

    谢谢大家的回复,我已经解决了。  跟ws_hgo说的差不多
    就在后面加个问号就可以传了 admin_left.aspx?type=1。
     接受的时候就<%=Request.QueryString["type"]%>