Add multiple [removed] events

前端 未结 8 1822
说谎
说谎 2020-12-02 10:31

In my ASP.NET User Control I\'m adding some JavaScript to the window.onload event:

if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType         


        
8条回答
  •  眼角桃花
    2020-12-02 11:01

    Actually, according to this MSDN page, it looks like you can call this function multiple times to register multiple scripts. You just need to use different keys (the second argument).

    Page.ClientScript.RegisterStartupScript(
        this.GetType(), key1, function1, true);
    
    Page.ClientScript.RegisterStartupScript(
        this.GetType(), key2, function2, true);
    

    I believe that should work.

提交回复
热议问题