This documentation is archived and is not being maintained.

Sys.Application.queueScriptReference Method

Visual Studio 2008

Sequentially queues the scripts to be loaded in the queued order.

Sys.Application.queueScriptReference(scriptUrl);

scriptUrl

The URL for the referenced script.

Use the queueScriptReference method to queue the scripts to be loaded based on the queued order. When scripts are loaded, they are loaded in parallel with the loading of the page and with the page's binary content. This method is an alternative to loading script by using inline <script> elements in the <asp:ScriptManager> element, which stops the page-loading process until the scripts are downloaded. The queueScriptReference method is invoked after the page markup has been loaded and displayed.

NoteNote:

The queueScriptReference method is used during asynchronous postbacks and ordinarily should not be called directly.

The following example uses the queueScriptReference method to load the scripts for two custom controls. It then loads the script for a third control that incorporates the other two. Finally, it creates an instance of the third control on the page.

function pageLoad() {
    // Make sure the scripts read in the proper order.
    Sys.Application.queueScriptReference("StopWatch.js");
    Sys.Application.queueScriptReference("StatusBar.js");
    Sys.Application.queueScriptReference("DownloadTracker.js");

    // Add custom controls to the application.
    $create(Demo.DownloadTracker, null, null, null, $get('div1'));
}
Show: