js 调用父窗口的方法
生活随笔
收集整理的這篇文章主要介紹了
js 调用父窗口的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
opener.show();
父窗體需要頂一個show() 方法
父面頁代碼:
?
<!DOCTYPE HTML PUBLIC "-//IETF//DTD LEVEL1//EN"> <html><head><title>html.html</title><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="this is my page"><meta http-equiv="content-type" content="text/html; charset=UTF-8"><!--<link rel="stylesheet" type="text/css" href="./styles.css">--></head><body><div><button id="btn">open new page</button></div><script>window.οnlοad=function(){var btn = document.getElementById("btn");btn.onclick = openPage;function openPage(){try {window.open('newpage.html'); }catch(e){alert(e);}//alert("ok");}}function show(){document.title=new Date();}</script></body> </html>newpage.html 代碼 需要打開的頁面
?
?
<!DOCTYPE HTML PUBLIC "-//IETF//DTD LEVEL1//EN"> <html><head><title>newpage.html</title><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="this is my page"><meta http-equiv="content-type" content="text/html; charset=UTF-8"><!--<link rel="stylesheet" type="text/css" href="./styles.css">--></head><body><button id="btn" οnclick="fun()">單擊</button><script>function fun(){opener.show();}</script></body> </html>?
?
轉載于:https://www.cnblogs.com/jiangu66/p/3192257.html
總結
以上是生活随笔為你收集整理的js 调用父窗口的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NSIS设置桌面快捷方式的图标
- 下一篇: Asp.net之MsChart控件动态绑