日期:2014-05-19  浏览次数:21082 次

弹出对话框问题!在线等
this.Response.Write( " <script> if(confirm( '确认删除 ')==false){window.location.href= 'tk_adminarticle.aspx '}; </script>
这段程序确定和取消怎么都执行下面的删除代码?

------解决方案--------------------
好像不能 "== false "
试试这样
this.Response.Write( " <script> if(!confirm( '确认删除 ')){window.location.href= 'tk_adminarticle.aspx '}; </script>

------解决方案--------------------
.cs文件 的PageLoad事件中
button.attributes.add( "onclick ", "return confirm( 'OK? '); ")

button_onclick中
response.redirect( "url ");
------解决方案--------------------
private void IBut_sc_Load(object sender, System.EventArgs e)
{
this.IBut_sc.Attributes.Add( "OnClick ", "return confirm( '确定要删吗? '); ");
}

我这是样做的
在初始化的时候加上一个属性!~!
感觉很好!~!~!

------解决方案--------------------
aspx ....
<body onload= "confirmTest() ">
<form id= "form1 " runat= "server ">
<div>

</div>
</form>
</body>
</html>


cs ...
protected void Page_Load(object sender, EventArgs e)
{

string jsStr =
" <script language= 'javascript '> "
+ "function confirmTest() "
+ "{ "
+ "if(!confirm( '确实要删除吗? ')) "
+ "{ "
+ "confirm( 'Hello '); "
+ "} "
+ "} "
+ " </script> ";
this.Response.Write(jsStr);

}

是这样的
但是== false都会执行


------解决方案--------------------
response.write
是不会等待的再服务器端的
服务器端是把这段代码(从response.write,到你你后面的删除代码)执行完再返回给客户端
也就是说在你看见confirm对话框以前
服务端就已经把删除工作完成了