Rem the vbs Private Sub changeStateClass(thechange As String) Dim rootobj As Variant Dim inc As Integer Dim tempinc As Integer Dim rootlength As Integer Dim i As Integer rootobj = document.getElementsByTagName("*") inc = 0 tempinc = 0 rootlength = rootobj.length For i = 1 To rootlength Step 1 If rootobj(i).className = thechange Then tempinc = tempinc + 1 End If Next i