如何在js警报后正确重新加载ASP页面。 [英] How to properly reload the ASP page after js alert.

查看:92
本文介绍了如何在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)

推荐答案

我想你需要一条确认信息,而不是这里的提醒是怎么回事



I think you need a confirmation message not the alert here is how

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页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆