关闭窗体 window.close() 和 window.open 弹出页面

本文介绍了使用JavaScript实现网页窗体自动关闭的方法,包括通过链接和按钮触发关闭操作,适用于不同场景下的窗体管理需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>不弹出提示框,自动关闭窗体</title>
</head>
<body>
<a href="#" onclick="window.opener=null;window.open('','_self');window.close();">关闭窗体 </a>
//框架页关闭:
 <input type="button" value="Close" onclick="javascript:top.close();">
</body>
</html>


<script type="text/javascript">
//关闭父窗体

function WindowClose()
{
parent.window.opener=null;
parent.window.open('','_self');
parent.window.close();
}

</script>

 

 

window.open 打开窗体


string openpage = "test.aspx?id=" + hidID.Value;
                string strScript = "";
                strScript += "<script language='javascript'>";
                strScript += "window.open('" + openpage + "','view','resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,top=260,left=300,width=750,height=450');";
                strScript += "</script>";
                Response.Write(strScript);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值