熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

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

2022-06-13   來源: JSP教程 
想要實現如題所示:父窗體需要頂一個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>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20535.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.