现在的位置: 首页 > 综合 > 正文

使用frameset关闭窗口

2018年01月27日 ⁄ 综合 ⁄ 共 432字 ⁄ 字号 评论关闭

在框架页面中,可以使用如下代码关闭页面

 

<html>
	<head>
		<title>模版</title>
       		<script type="text/javascript">
           
			function closeWin(){
				parent.window.opener=null;
				parent.window.close();			
			}
       		</script>
	</head>
	<body>

		<input type="button" value="关闭按钮" onclick="closeWin()"/>
	</body>
</html>

 

解决方案二

 

 

<html>
	<head>
		<title>模版</title>
       		<script type="text/javascript">
           
			function closeWin(){
				
				window.top.close();

				
			}
			

            
       </script>
	</head>
	<body>

		<input type="button" value="关闭按钮" onclick="closeWin()"/>
	</body>
</html>

 

抱歉!评论已关闭.