页面之间跳转传值(1)

页面之间传值:

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

<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>  
原文地址:https://www.cnblogs.com/dongtianqi/p/7458214.html