簡體   English   中英

將頁面重定向到Java腳本功能警報框(確定)上,單擊

[英]redirect the page on Java script function alert box (OK) click

以下是我在aspx頁面上的Java腳本函數

<script>
 function alert6() {
            alert("You Can't Delete This Record");
        }
</script>

並使用我的CS頁面上的功能,我想在用戶單擊“確定”后重定向頁面,我需要做什么?

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);

如果您僅想在單擊警報框的“確定”按鈕后重定向頁面,請嘗試此操作

<script>
 function alert6() {
  alert("You Can't Delete This Record");
  window.location="Your page";
        }
</script>

叫它

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);

我對ASP .NET不太了解。 但是據我了解,您正在嘗試將JavaScript函數打印到頁面上,當單擊“確定”按鈕時,該函數將重定向頁面。

正如您所說的那樣,您可以使用下面的函數。 我假設“確定”按鈕的ID為“ btnOk”。

$("#btnOk").click(function(){
   window.location = "http://www.yoururl.com";
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM