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() 方法
父面頁代碼:
<!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 代碼 需要打開的頁面
<!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() 方法
父面頁代碼:
復(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 代碼 需要打開的頁面
復(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)文章
Javascript獲取CSS偽元素屬性的實(shí)現(xiàn)代碼
這篇文章主要介紹了Javascript獲取CSS偽元素屬性的實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-09-09js 獲取網(wǎng)絡(luò)圖片的高度和寬度的實(shí)現(xiàn)方法(變通了下)
簡(jiǎn)單地說就是把圖片放入一個(gè)自動(dòng)伸縮的DIV中,然后獲取DIV的寬和高!這個(gè)不錯(cuò)的變通,大家可以參考下。2009-10-10最全正則表達(dá)式總結(jié):驗(yàn)證QQ號(hào)、手機(jī)號(hào)、Email、中文、郵編、身份證、IP地址等
這篇文章主要介紹了最全正則表達(dá)式:驗(yàn)證QQ號(hào)、手機(jī)號(hào)、Email、中文、郵編、身份證、IP地址等,通過語法介紹作用表達(dá)式等詳細(xì)解釋了正則表達(dá)式的使用,具體操作步驟大家可查看下文的詳細(xì)講解,感興趣的小伙伴們可以參考一下。2017-08-08JavaScript制作淘寶星級(jí)評(píng)分效果的思路
這篇文章主要介紹了JavaScript制作淘寶星級(jí)評(píng)分效果的整個(gè)思考過程,思路很清晰,并附帶了完整的程序源碼,感興趣的小伙伴們可以參考一下2015-11-11