html 页面之间跳转和传值


从a.html 跳转到b.html 并吧 a.html 的值传入b.html


a.html

<html>
 <head>
  <title> New Document </title>
    <script>
      function   to (){
        var  getval =document.getElementById("cc").value;
        document.location.href("b.html?cc="+getval);   
      }
    </script>
 </head>
 <body>
  <input type="text" id ="cc" > <input type="button"  value="a"  onclick="to()" >
 </body>
</html>

b.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 <title> New Document </title>
 <script>  
  var thisURL = document.URL;  
  var  getval =thisURL.split('?')[1];
  var showval= getval.split("=")[1];
  function  showvalf(){
     alert(showval);
     document.getElementById('ee').value=showval;
  }
</script>
 </head>
 <body onload="showvalf()">
  <input type="text"  id ="ee" />
 </body>
</html>



阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭