当前位置: 代码迷 >> ASP.NET >> 为什么弹出窗口无效?解决方法
  详细解决方案

为什么弹出窗口无效?解决方法

热度:4776   发布时间:2013-02-25 00:00:00.0
为什么弹出窗口无效?
用的是vb.net
程序里这样2句
response.write( " <script> alert( '…… ') </script> ")
response.redirect( "xx.aspx ")
为什么直接跳转到xx.aspx而不弹出警告窗口?


------解决方案--------------------------------------------------------
用的是vb.net
程序里这样2句
response.write( " <script> alert( '…… ') </script> ")
response.redirect( "xx.aspx ")
为什么直接跳转到xx.aspx而不弹出警告窗口?


因为
response.write( " <script> alert( '…… ') </script> ")
( " <script> alert( '…… ') </script> 这一段是要发送给IE运行的,但是还没有发送到IE,你的代码已经
response.redirect( "xx.aspx ")
重导向了,所以直接就导向了

------解决方案--------------------------------------------------------
to:zyug(LovlyPuppy)
你的方法可行
但是弹出窗口的时候原来的窗口一片空白了
请问任何解决?
--------------------------
Page.ClientScript.RegisterStartupScript(this.GetType(), "key ", " <script> alert( '…… ');location.href( 'xx.aspx '); </script> ");
------解决方案--------------------------------------------------------
Page.RegisterStartupScript( "anywords ", " <script> alert( '…… ');location.href( 'xx.aspx '); </script> ")
  相关解决方案