簡體   English   中英

延遲后獲取標簽以更改文本/重定向頁面的最佳方法

[英]Best way to get a label to change text/ redirect page after delay

我正在嘗試在asp.net(c#)中實現以下流程:

  1. 用戶點擊按鈕
  2. 出現了文本標簽
  3. 等待3秒
  4. 重新載入頁面

我一直在嘗試在C#中做一些事情,但是我開始認為在javascript中實現它更容易

任何幫助/建議將不勝感激。

這樣嘗試

 <script type="text/javascript"> function callthis() { setTimeout('window.location = "home.aspx"', 3000); } </script> 

從服務器端調用此按鈕單擊

如果您使用了更新面板,則可以使用:

ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "callthis();", true);

您可以使用的其他明智

ClientScript.RegisterStartupScript
        (GetType(),Guid.NewGuid().ToString(), "callthis();",true);

暫無
暫無

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

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