簡體   English   中英

Fancybox-ASP.NET OnLoad

[英]Fancybox - ASP.NET OnLoad

我希望Fancybox無需單擊即可工作,而是在加載時自動打開。

我試過了,但是沒有用:

內容.cs

protected void Page_Load(object sender, EventArgs e)
{
    Presenter.InitializeView(this);

    string myScript = "$('#divMessageBox').fancybox();";
    ClientScript.RegisterStartupScript(typeof(Page), "alert", myScript, true);
}

內容.aspx

<div id="divMessageBox" style="width:400px;height:100px;overflow:auto;">
            <asp:Label ID="lblMessage" runat="server" Text="testando Fancybox" />
        </div>

您可以使用RegisterStartupScript()將其RegisterStartupScript()在頁面加載時運行,如下所示:

string myScript = "$('#myFancybox').fancybox();" //add options if needed
ClientScript.RegisterStartupScript(typeof(Page), "alert", script, true);

暫無
暫無

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

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