Home >Web Front-end >JS Tutorial >js specific implementation code for calling the parent window_javascript skills

js specific implementation code for calling the parent window_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:28:451012browse

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>


Statement:
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