scripts 属性

       

返回 IHTMLElementCollection 集合对象,该对象代表当前文档中所有 <SCRIPT> 元素的集合。

expression.scripts

expression  必选。返回 DispFPHTMLDocument 对象的表达式。

说明

此集合先按名称索引,再按标识符索引。如果发现相同的名称,则返回具有该名称的项目的集合。相同名称的集合随后必须按位置序号进行引用。

示例

下列示例创建对当前文档脚本集合的引用,并显示集合中每个脚本的标题(如果存在)。

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