1) 新页面式,通过使用window.open()

父页面parent.html

 
  
  1. <html> 
  2. <head> 
  3. <title>parent</title> 
  4. <script language="javascript"> 
  5.     function method() {  
  6.         window.open("child.html");  
  7.     }  
  8. </script> 
  9. </head> 
  10. <body> 
  11.     <form method=post action=""> 
  12.         <input type="text" name="" id="textparent"/><br> 
  13.     </form> 
  14.     <input type="button" value="foward" onclick="method()"/> 
  15. </body> 
  16. </html> 

子界面child.html

 
  
  1. <html> 
  2. <head> 
  3. <title>child</title> 
  4. <script language="JavaScript"> 
  5.     function getValue(str) {  
  6.         window.opener.document.getElementById("textparent").value = str;  
  7.         window.close();  
  8.     }  
  9.  
  10.     function load() {  
  11.         var str = window.opener.document.getElementById("textparent").value;  
  12.         window.document.getElementById("textchild").value = str;  
  13.     }  
  14. </script> 
  15. </head> 
  16. <body onload="load()"> 
  17.     <input type="text" name="" id="textchild" /><br> 
  18.     <a href="parent.html" onclick="getValue('11')">111</a> 
  19.     <a href="parent.html" onclick="getValue('22')">222</a> 
  20. </body> 
  21. </html> 

点击父页面按钮跳转到新页面,也就是子页面,点击子页面的链接将值传递回父页面中,查看效果。