本文介绍了如何在js警报后正确重新加载ASP页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用javascript弹出警告消息并刷新页面。但是,当点击警报显示的按钮然后它没有停止重新加载时会发生什么。这是我的代码。



我尝试了什么:



i used javascript to make a pop an alert message and refresh the page . but what happens is when is click the button the alert shows then it is not stopping from reloading. here's my code.

What I have tried:

ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('This student record already exist');window.location.reload();", True)

推荐答案

var r = confirm("Successful Message!");
    if (r == true){
      window.location.reload();
    }



或者这里是替代品。


or here is an alternate.

if(alert('Alert For your User!')){}
else    window.location.reload(); 



短版


short version

if(!alert('Alert For your User!')){window.location.reload();}


这篇关于如何在js警报后正确重新加载ASP页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 02:01
查看更多