Home > Web Front-end > JS Tutorial > Example of js subpage getting parent page data_javascript skills

Example of js subpage getting parent page data_javascript skills

WBOY
Release: 2016-05-16 16:48:10
Original
1465 people have browsed it

When doing page preview, the data is not stored in the database, but a page needs to be opened for preview. I asked the aunts and found out that this is how it is done.

1. Parent page

Copy code The code is as follows:

< input type="text" id="name" value="zhangsan"/>
Preview

2. The subpage, that is, a.html gets the value of the text box in the parent page
Copy the code The code is as follows :

$(function(){

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

In this way, what comes out in the console is the value of the text box on the parent page

Don't hurry say have no choice, perhaps, next intersection will meet hope.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template