在aspx页面A中,插入了谷歌地图,地图的操作完全用js完成。现在想实现,右击地图弹出菜单,其中有个选项是打开新aspx页面B,并把从地图中获得的数据传递到B页面中。现在已经实现右键菜单和打开新页面功能,但是数据传送不成功。数据只是页面A中javascript的一个变量值。请教各位有什么好方法吗?还请讲得详细些,谢谢。

解决方案 »

  1.   

    A页面:
    <html>
    <head>
    </head>
    <body>
    <input type="button" value="传递" onclick="location.href('2.html?a=3')"/>
    </body>
    </html>
    B页面:
    <html>
    <head>
    <script>
    function getValue(XelementId)
    {
        var search=location.search;
        var value=search.substring(search.indexOf("=")+1);
        var div=document.getElementById(XelementId);
        div.innerHTML=value;
    }
    </script>
    </head>
    <body>
    <div id="div1"></div>
    <script>getValue("div1");</script>
    </body>
    </html>
      

  2.   

    如果A页面如下:
    <html>
    <head>
    <script language="javascript">
        funtion open () {
            window.open("B.aspx");
            var name = "me";
        }
    </script>
    </head>
    <body>
    <input type="button" value="传递" onclick="open();"/>
    </body>
    </html>
    怎样把 name的 值传到B页面 ?不通过URL,如果是两个变量的值呢?
      

  3.   

    <html>
    <head>
    <script language="javascript">
        funtion open () {
            var name = "me";
            window.open("B.aspx?name="+name);
        }
    </script>
    </head>
    <body>
    <input type="button" value="传递" onclick="open();"/>
    </body>
    </html>B.aspxstring name=request.QueryString ["name"]
      

  4.   

    <html>
    <head>
    <script language="javascript">
      funtion open () {
      var name = "me";
      window.open("B.aspx?name="+name);
      }
    </script>
    </head>
    <body>
    <input type="button" value="传递" onclick="open();"/>
    </body>
    </html>B.aspxstring name=request.QueryString ["name"]
      

  5.   

    html 怎么做?可以得到上个画面传的参数?除了1楼的方法?