国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

js 調用父窗口的具體實現代碼

2019-11-20 22:31:10
字體:
來源:轉載
供稿:網友
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.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>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 任丘市| 囊谦县| 张掖市| 三台县| 景德镇市| 九龙城区| 米泉市| 资源县| 灵丘县| 达尔| 安多县| 赤峰市| 石狮市| 胶州市| 政和县| 横峰县| 梓潼县| 西乌珠穆沁旗| 诸城市| 台南市| 双辽市| 达日县| 湛江市| 赤峰市| 台安县| 平舆县| 江达县| 卓资县| 长海县| 漾濞| 景谷| 临高县| 旬阳县| 手游| 界首市| 财经| 徐汇区| 岳阳市| 东方市| 东方市| 湘乡市|