asp.net中的confirm分支确认轻松实现
1.放置一个服务器控件 在服务器控件的button1_onclick事件中执行插入命令 。在loadpage() 中增添button1.Attributes.Add("onclick","return confirm('确认提交数据吗?');")
2.单纯提醒!Response.Write("<script language=javascript>alert("xxxxxxxxxxxx");</script>");
3.if(超过额度)
{
Response.Write("<script>if(confirm('超过额度,是否继续?')) location='B.aspx';
else history.go(-1);</script>");
}
else
{
Response.Write("<script>location='B.aspx';</script>");
}
string str="<script language='javascript'>alert('省局数据不能进行修改!');</script>"; Page.RegisterStartupScript("dd",str);
window.close关闭窗口,不弹出系统提示,直接关闭
当我们用这种方法:Response.Write("<script>window.close()</script>")
总是提示什么:你查看的网页试图关闭的提示
如何去掉提示,直接关闭窗体?
可以用以下方法:
Response.Write("<script>window.opener=null;window.close()</script>")
只有ie6才支持.
opener只要设为任何值都可以,不会出现提示
如果是通过子窗体关闭父窗体时怎么做呢
子窗体(弹出窗体):
同理可得:
Response.Write("<script>window.opener.top.opener=null;window.opener.top.close()</script>")
浙公网安备 33010602011771号