scripts Property

       

Returns an IHTMLElementCollection collection object that represents the collection of all <SCRIPT> elements in the current document.

expression.scripts

expression   Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example creates a reference to the current document's scripts collection and displays the title (if it exists) for each script in the collection.

Sub ReturnScripts()
'Returns a collection of all scripts in the document

    Dim objApp As FrontPage.Application
    Dim objScripts As IHTMLElementCollection
    Dim objScript As IHTMLElement

    Set objApp = FrontPage.Application
    Set objScripts = objApp.ActiveDocument.scripts
    'For each script in the document
    For Each objScript In objScripts
        'if it has a title, display it
        If Not objScript.Title = "" Then
            MsgBox objScript.Title
        End If
    Next objScript

End Sub