Home > Web Front-end > JS Tutorial > How to output content to the parent window after JavaScript pops up a new window_javascript skills

How to output content to the parent window after JavaScript pops up a new window_javascript skills

WBOY
Release: 2016-05-16 16:05:42
Original
1315 people have browsed it

The example in this article describes the method of outputting content to the parent window after JavaScript pops up a new window. Share it with everyone for your reference. The details are as follows:

The following JS code demonstrates how to open a pop-up window through the window.open method, and then output information to the parent window through the handle of the pop-up window

<!DOCTYPE html>
<html>
<head>
<script>
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
myWindow.opener.document.write("<p>This is the source window!</p>");
}
</script>
</head>
<body>
<input type="button" value="Open 'myWindow'" onclick="openWin()" />
</body>
</html>
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

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