js 調(diào)用父窗口的具體實(shí)現(xiàn)代碼
更新時(shí)間:2013年07月15日 18:06:35 作者:
想要實(shí)現(xiàn)如題所示:父窗體需要頂一個(gè)show()方法,具體實(shí)現(xiàn)代碼如下,感興趣的朋友可以參考下哈,希望對(duì)大家有所幫助
opener.show();
父窗體需要頂一個(gè)show() 方法
父面頁(yè)代碼:
<!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.onload=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 代碼 需要打開(kāi)的頁(yè)面
<!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" onclick="fun()">單擊</button>
<script>
function fun(){
opener.show();
}
</script>
</body>
</html>
父窗體需要頂一個(gè)show() 方法
父面頁(yè)代碼:
復(fù)制代碼 代碼如下:
<!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.onload=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 代碼 需要打開(kāi)的頁(yè)面
復(fù)制代碼 代碼如下:
<!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" onclick="fun()">單擊</button>
<script>
function fun(){
opener.show();
}
</script>
</body>
</html>
相關(guān)文章
ClearTimeout消除閃動(dòng)實(shí)例代碼
本文給大家介紹ClearTimeout消除閃動(dòng)相關(guān)知識(shí),本文介紹的非常詳細(xì),具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧2016-02-02
JavaScript實(shí)現(xiàn)簡(jiǎn)易QQ聊天界面
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)簡(jiǎn)易QQ聊天界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-07-07
vue+ts下對(duì)axios的封裝實(shí)現(xiàn)
這篇文章主要介紹了vue+ts下對(duì)axios的封裝實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-02-02
微信小程序?qū)崿F(xiàn)長(zhǎng)按刪除圖片的示例
本篇文章主要介紹了微信小程序?qū)崿F(xiàn)長(zhǎng)按刪除圖片的示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-05-05
JS實(shí)現(xiàn)定時(shí)頁(yè)面彈出類似QQ新聞的提示框
類似QQ新聞的提示框要求頁(yè)面每隔半小時(shí)彈出一次提示消息,下面有個(gè)不錯(cuò)的實(shí)現(xiàn)方法,感興趣的朋友可以參考下2013-11-11
JavaScript的parseInt 進(jìn)制問(wèn)題
今天在整理以前寫過(guò)的一段根據(jù)周期值自動(dòng)計(jì)算下次執(zhí)行日期的js代碼,發(fā)現(xiàn)一bug,我使用parseInt對(duì)源數(shù)據(jù)串進(jìn)行轉(zhuǎn)換,當(dāng)輸入類似:2009-05-05時(shí),parseInt將把串的05做8進(jìn)制轉(zhuǎn)換,這樣結(jié)果自然就不對(duì)了。2009-05-05
JS實(shí)現(xiàn)運(yùn)動(dòng)緩沖效果的封裝函數(shù)示例
這篇文章主要介紹了JS實(shí)現(xiàn)運(yùn)動(dòng)緩沖效果的封裝函數(shù),涉及JavaScript時(shí)間函數(shù)與數(shù)值運(yùn)算相關(guān)操作技巧,需要的朋友可以參考下2018-02-02

