0
4

1 回答 1

1

Length与 VBScript 一起工作得很好。也getAttribute("class")行不通,但是element.className。这是示例代码。

<html>
 <head>
  <title>AAA</title>
  <script type="text/vbscript">
    Sub Window_Onload
        Set objElms = Document.getElementsByTagName("a")
        MsgBox "A.Length: " & objElms.Length
        For Each objElm In objElms
            If objElm.className = "ASCE-Url" Then
                'do what you need here...
                objElm.innerHTML = objElm.innerHTML & " - found"
            End If
        Next
    End Sub

  </script>
 </head>
 <body>

   <a class=ASCE-Url href="#">A</a><br>
   <a class=ASCE-Url href="#">B</a><br>
   <a class=ASCE-XYZ href="#">C</a><br>
   <a class=ASCE-Url href="#">D</a><br>
   <a class=ASCE-Url href="#">E</a><br>

 </body>
</html>
于 2013-02-18T14:46:23.593 回答