The js child page gets a sample of the parent page data

  • 2020-03-30 03:00:16
  • OfStack

Do the page preview, the data is not stored in the database, but to open a page to preview, ask the aunt, the original is to do so.

1. Parent page
 
<input type="text" id="name" value="zhangsan"/> 
<a href="a.html" target="_blank"> preview </a> 

2. The child page, a.html, gets the value of the text box in the parent page
 
$(function(){ 

console.info(window.opener.document.getElementById("name").value); 
}); 

What comes out of the console is the value of the parent page's textbox

Don't hurry say have no choice, perhaps, next intersection will meet hope.

Related articles: