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

(编辑:jimmy 日期: 2024/10/10 浏览:2)

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>

一句话新闻

高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。