Maison  >  Article  >  interface Web  >  js 调用父窗口的具体实现代码_javascript技巧

js 调用父窗口的具体实现代码_javascript技巧

WBOY
WBOYoriginal
2016-05-16 17:28:45958parcourir

opener.show();
父窗体需要顶一个show() 方法
父面页代码:

复制代码 代码如下:




html.html












<script> <br><br>window.onload=function(){ <br><br>var btn = document.getElementById("btn"); <br><br>btn.onclick = openPage; <br><br>function openPage(){ <BR>try { <BR>window.open('newpage.html'); <BR>}catch(e){ <BR>alert(e); <BR>} <BR>//alert("ok"); <BR>} <BR>} <BR>function show(){ <BR>document.title=new Date(); <BR>} <BR></script>



newpage.html 代码 需要打开的页面
复制代码 代码如下:




newpage.html








<script> <br><br>function fun(){ <BR>opener.show(); <BR>} <br><br></script>


Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn