开发者

Fancybox - ASP.NET OnLoad

I want Fancybox to work without a click, but instead open automatically on load.

I tried this but it doesn't work:

content .cs

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

    string myScript = "$('#divMessageBox').fa开发者_开发问答ncybox();";
    ClientScript.RegisterStartupScript(typeof(Page), "alert", myScript, true);
}

content .aspx

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


You can register it to run when the page loads using RegisterStartupScript(), like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜