javascript

位置:IT落伍者 >> javascript >> 浏览文章

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


发布日期:2018年08月06日
 
js 调用父窗口的具体实现代码
想要实现如题所示:父窗体需要顶一个show()方法具体实现代码如下感兴趣的朋友可以参考下哈希望对大家有所帮助

openershow();
父窗体需要顶一个show() 方法
父面页代码

复制代码 代码如下:
<!DOCTYPE HTML PUBLIC "//IETF//DTD LEVEL//EN">
<html>
<head>
<title>htmlhtml</title>

<meta httpequiv="keywords" content="keywordkeywordkeyword">
<meta httpequiv="description" content="this is my page">
<meta httpequiv="contenttype" content="text/html; charset=UTF">
<!<link rel="stylesheet" type="text/css" href="/stylescss">>
</head>
<body>

<div>
<button id="btn">open new page</button>
</div>

<script>

windowonload=function(){

var btn = documentgetElementById("btn");

btnonclick = openPage;

function openPage(){
try {
windowopen(newpagehtml);
}catch(e){
alert(e);
}
//alert("ok");
}
}
function show(){
documenttitle=new Date();
}
</script>
</body>
</html>


newpagehtml 代码 需要打开的页面

复制代码 代码如下:


<!DOCTYPE HTML PUBLIC "//IETF//DTD LEVEL//EN">
<html>
<head>
<title>newpagehtml</title>

<meta httpequiv="keywords" content="keywordkeywordkeyword">
<meta httpequiv="description" content="this is my page">
<meta httpequiv="contenttype" content="text/html; charset=UTF">
<!<link rel="stylesheet" type="text/css" href="/stylescss">>
</head>
<body>
<button id="btn" onclick="fun()">单击</button>
<script>

function fun(){
openershow();
}

</script>
</body>
</html>

上一篇:JS实现随机化快速排序

下一篇:javascript跟随滚动效果插件代码