向源(父)窗口写一些文本
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function openWin() {
- var myWindow = window.open("", "", "width=400, height=200");
- myWindow.opener.document.getElementById("demo").innerHTML =
- "已经打开一个新窗口。";
- }
- </script>
- </head>
- <body>
- <button onclick="openWin()">打开 myWindow</button>
- <p id="demo"></p>
- </body>
- </html>