zoukankan      html  css  js  c++  java
  • js 调用父窗口的方法

    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>
    



  • 相关阅读:
    党史回顾+十九大习思想+中国历史事件+地理+航天史及古代天文历法
    国际组织
    生活-常识-物理
    生物
    数量题目总结-利润排列组合
    数量题目总结-工程最值集合
    考公错题记录表
    个人向简历介绍
    数据库操作大全
    团队博客作业-技术规格说明书
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3192257.html
Copyright © 2011-2022 走看看