第一个画面的标题为“TEST1.htm”,画面上有一个文本输入框和一个按钮,如果文本输入框填写了内容,按钮click 以后跳转到新画面“TEST2.htm”,网页上显示刚才文本框的内容。在线等。我是菜鸟。谢谢大侠了

解决方案 »

  1.   

    test1.html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
     </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function openNew(){
    window.open("test2.html","test2");
    }
    //-->
    </SCRIPT>
     <BODY>
      <INPUT TYPE="text" NAME="test1" ID="test1">
      <INPUT TYPE="button" VALUE="OPEN" ONCLICK="openNew();">
     </BODY>
    </HTML>test2.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
     </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    window.onload = function() {
    document.body.innerHTML = window.opener.document.getElementById("test1").value;
    }
    //-->
    </SCRIPT>
     <BODY>  
     </BODY>
    </HTML>
      

  2.   

    test1.html:
      <form action="test2.html" method="get">
        <input name="te" tyope="text" /><input type="submit" value="提交" />
      </from>
    test2.html:
      <script>
      onload = function() {
        //解析url获取参数,不过有局限,就是这个参数必须是在最后,而且前面不能有和这个参数名一样的字符串
        var url = decodeURIComponent(window.location.href);
        var startInd = url.indexOf('=');
        var ind = url.substring(startInd).indexOf('te');
        document.getElementById('result').innerHTML = url.substring(ind+startInd+2,url.length);
      }
    </script>
    <div id="result"></div>
      

  3.   


    <script>    function jump(){
            var txt=document.getElementById("txt").value;
            location.href="b.html?value="+txt;
        }
      </script>
    <body>
        <input type="text" id="txt"><input type="button" value="跳转" onclick="jump()">
    b.html
    <script>
        window.onload=function(){
            document.getElementById("txt").value=getdatafromStr(location.href,"value")
        }
        function getdatafromStr(str,name){
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = str.substr(str.indexOf("\?")+1).match(reg);
            if (r!=null) return unescape(r[2]); return null;
        }
    </script>
    <body>
        这是B画面
        <input type="text" id="txt">
      

  4.   

    1.htm代码
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
     </HEAD>
    <script language="javascript">
    function test()
    {
      var name=document.getElementById("id").value;
      self.location='2.htm';
      document.cookie="name="+name;
    }
    </script>
     <BODY>  <input type="text" id="id" name="name">
      <input type="button" name="test" value="test" onclick="test();">
      
     </BODY>
    </HTML>
    2.htm代码
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
     </HEAD>
    <script language="javascript">
    window.onload=function() 
    {
     var name=document.cookie.split(";")[0].split("=")[1];
     document.getElementById("la").childNodes[0].nodeValue=name;
    }
      
    </script>
     <BODY>
       <label id="la">test</label>
     </BODY>
    </HTML>
      

  5.   

    哇,100分哦, 我也来个test1.htm
    <!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 language="javascript" type="text/javascript">
            function Go() {
                var value = document.getElementById("tbValue").value;
                window.open("test2.htm?" + value);
            }
        </script>
    </head>
    <body>
    值:<input id="tbValue" type="text" value="abcd" />
    <input type="button" value="go" onclick="Go()" />
    </body>
    </html>test2.htm
    <!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 language="javascript" type="text/javascript">
            window.onload = function() {
            var tb = document.getElementById("tbGetValue");
                
                //value的内容将为 ?abcd
                var value = window.location.search;
                tb.value = value.substr(1); //去掉问号
            }
        </script>
    </head>
    <body>
        <input id="tbGetValue" type="text" />
    </body>
    </html>
      

  6.   


    up这个,不推荐使用其它的window.open,容易被浏览器拦截
      

  7.   


    但是用这种方法页面根本就没法跳转了。location.href="b.html?value="+txt;
    就是这句代码不起作用
      

  8.   

    IE6我用的window.location.href="b.html?value="+txt;
    alert(window.location.href)倒是可以获取到地址和参数的。
    就是页面不跳转。郁闷!
      

  9.   

    a和b是分开的两个html.在b.html里的是我下面写的,a中是上面写的我的也是IE6,没什么问题的,可能是你什么地方没弄对