defer Property
Sets or retrieves a String that represents the status of an FPHTMLScriptElement or IHTMLScriptElement object. Corresponds to the defer attribute for the SCRIPT element.
expression.defer
*expression * Required. An expression that returns one of the objects in the Applies To list.
Remarks
The value of the defer property can be one of the following string values:
true |
Script execution is deferred. |
false |
Script execution is not deferred. |
Use the defer property to set the defer attribute for a SCRIPT element that contains only function declarations. Setting the defer attribute to "true"
tells the browser that it doesn't need to read the entire script before loading and displaying the page. Use the defer attribute only when the SCRIPT element contains only functions and when subsequent scripts that are immediately executed do not call any of these functions as immediately executed code defined within a deferred script can react unpredictably.
Example
The following example defers execution of the first script in the active document when the document is displayed in a browser.
Dim objScript As FPHTMLScriptElement
Set objScript = ActiveDocument.Scripts.Item(0)
objScript.defer = "true"
Applies to | FPHTMLScriptElement Object | IHTMLScriptElement Object