2011-09-17 27 views
0

我写这行的在我的项目代码..我怎样才能在客户端页面)OK按钮消息框的响应

ClientScript.RegisterStartupScript(this.GetType(“我的警报”,“警报(” “+ mystringvariable +”');“,true);

Response.Redirect(“Home.aspx”);

,并在其中发生了什么,它直接跳出来主页没有弹出一个消息.. 怎么能按下OK按钮,那么它应该主页上重定向后弹出一个消息......

PLS尽快帮我。

回答

0

如果你看看生成的HTML,你会看到你说的浏览器重定向,然后它会开始执行JavaScript。你要做的JS重定向过 - 这里是一个不错的tutorial

而且看看

AlertEvents

0

你还是用JS确认,OK按钮让JS重定向如:

<html> 
<head> 
<script type="text/javascript"> 

function confirmation() { 
var answer = confirm("Question?") 
if (answer){ 
    //your home.aspx 
    window.location = "http://www.google.com/"; 
} 

} 

</script> 
</head> 
<body> 
<form> 
<input type="button" onclick="confirmation()" value="OK"> 
</form> 
</body> 
</html> 

应该到哪里进入ClientScript.RegisterStartupScript。

相关问题