[英]redirect the page on Java script function alert box (OK) click
below is my java script function on aspx page 以下是我在aspx页面上的Java脚本函数
<script>
function alert6() {
alert("You Can't Delete This Record");
}
</script>
and use the function on my cs page, i want to redirect the page after the user clicks on OK what i Need to do? 并使用我的CS页面上的功能,我想在用户单击“确定”后重定向页面,我需要做什么?
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);
Simply if you want to redirect the page just after clicking on Ok button of alert box then try this 如果您仅想在单击警报框的“确定”按钮后重定向页面,请尝试此操作
<script>
function alert6() {
alert("You Can't Delete This Record");
window.location="Your page";
}
</script>
and call it 叫它
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);
I don't have much knowledge on ASP .NET. 我对ASP .NET不太了解。 But as I understand, you are trying to print out a javascript function to the page which would redirect the page when the OK button is clicked. 但是据我了解,您正在尝试将JavaScript函数打印到页面上,当单击“确定”按钮时,该函数将重定向页面。
As you said you are using JQuery you can use the function below. 正如您所说的那样,您可以使用下面的函数。 I am assuming the id of the OK button is 'btnOk'. 我假设“确定”按钮的ID为“ btnOk”。
$("#btnOk").click(function(){
window.location = "http://www.yoururl.com";
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.