window1中点击一个link打开window2,在window2中点击一个button,跳转回window1并在window1上alert(“done”),点击确定alert,window2 close
默认分类 2011-09-04 19:16:46
a.htm
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled 1</title>
- <script type="text/javascript">
- <!--
- var a;
- function popup(){
- a = window.open('b.htm');
- }
- function showMsg(){
- alert(123);
- a.close();
- }
- //-->
- </script>
- </head>
-
- <body>
- <a href="#nogo" onclick="popup()">open</a>
- </body>
-
- </html>
b.htm
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled 1</title>
- <script type="text/javascript">
- <!--
- function go(){
- window.opener.focus();
- window.opener.showMsg();
-
- }
- //-->
- </script>
- </head>
-
- <body>
- <button onclick="go()">back</button>
- </body>
-
- </html>
>>
留言评论