怎么个不同的网页?同一个网站的话可以用cookies

解决方案 »

  1.   


    parent.htm
    <html>
    <body>
    <form id = 'frmMain' name = 'frmMain'>
    <button onclick = 'getValue();'>getValue</button>
    <input type = 'textbox' value = "" id = 'txtValue' name = 'txtValue' style = 'display: none'/>
    <button id = 'btnReturn' name = 'btnReturn' onclick = 'returnValue();' style = 'display: none'></button>
    </form>
    <script type = 'text/javascript'>
    <!--//
    var winHandler = null;
    function getValue(){
    winHandler = window.open("child.htm", "child");
    }function returnValue(){ 
    alert( document.getElementById('txtValue').value ); 
    }
    //-->
    </script>
    </body>
    </html>child.htm<html>
    <body>
    <button onclick = 'btnClose_Click();'>close</button>
    <input type = 'textbox' id = 'txtInput' value = ''/>
    <script type = 'text/javascript'>
    <!--//
    var winHandler = null;
    function btnClose_Click(){
    if (window.opener != null){
      var txt = window.opener.document.frmMain.txtValue;   
      var btn = window.opener.document.frmMain.btnReturn;
      if (txt != null){
      txt.value = document.getElementById('txtInput').value;
      }
      btn.click();
    }
    self.close();
    }
    //-->
    </script>
    </body>
    </html>
    我认为这个跟你说的有点类似,不妨一看.
      

  2.   

    session  application  cookie
    url get方式  form post方式
      

  3.   


    father.html
    <html>
    <head>
    <script language="javascript">
    function openSon()
    {
      var abc = showModalDialog("son.html","");
      document.all.txt.value = abc;
    }
    </script>
    <head>
    <body>
    <form>
    <input type = "textbox" name = "txt"/>
    <input type = "button" name = "bt" value = "打开" onclick ="openSon()"></button>
    </form>
    </body>
    </html>son.html
    <html>
    <head>
    <script language = "javascript">
    function returnMe()
    {
       window.returnValue = document.all.txt.value;
       close();
    }
    </script>
    <head>
    <body>
    <input type = "textbox" name = "txt"/>
    <input type = "button" name ="bt" value = "确定" onclick = "returnMe()"></button>
    </body>
    </html>
    这个你试试`  跟4楼的很像.  只是窗口不同
      

  4.   

    不是很明白楼主的意思
    不过父界面和子界面可以传递变量可以通过下面几种方式:
     
    子界面可以通过下面的方式返回值到父界面,由父界面使用;  window.returnValue = obj;这里的obj可以是各种数据类型(js是弱语言嘛)子界面同样可以访问父界面的所有元素,包括变量,通过下面方式实现: var obj = window.dialogArguments;
     obj.obj2;这里的obj2可以是父界面的元素,假设父界面有个Id为"name"的元素,
    则子界面访问该元素,可以这样:
    obj.document.getElementById("name");
    如果obj2是父界面的变量,则直接用变量名访问:obj.变量名;
    声明一下,如果obj2是变量,应该是全局变量,局部变量是访问不到的
      

  5.   

    补充说明一点:
    如果在界面之间传递变量值,可以将变量值直接跟在路径后:  var variableOne = "hello!";
      window.open(url + "?amount=1&variableOne=" + variableOne);子界面可以通过下面的方式获得父界面传递过来的值: var value = GetArgsFromHrefs(location.search,"variableOne");
     function GetArgsFromHrefs(sHref, sArgName) { 
        var retval = new Array();
        var args  = sHref.split("?");
        if(args[0] == sHref) /*参数为空*/
        {
             return retval; /*无需做任何处理*/
        }
        var str = args[1];
        args = str.split("&");
        for(var i = 0; i < args.length; i ++)
        {
            str = args[i];
            var arg = str.split("=");
            if(arg.length <= 1) continue;
            if(arg[0] == sArgName) retval[retval.length] = arg[1];
        }
       return retval;
    }可以加上多个变量:  var variableOne = "hello,";
      var variableTwo = "world!"
      window.open(url + "?amount=1&variableOne" + variableOne + "&variableTwo" +variableTwo);子界面同样可以通过上面的方法得到值.