Jump to content

How to getElementsByTagName?


Recommended Posts

Wonder why there is no command "getElementsByTagName" as in javascript..It seems like that would be a very useful tool.

so I am trying to modify the next best command.. can someone help me..

Func dolinks_now()
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
if $oElement.tagname = "h1" then msgbox(0, "", $oElement.innerText)
; Msgbox(0, "", $oElement.tagname & ":" & $oElement.innerText & @CRLF)
Next
EndFunc

When I remove the ; from the msgbox.. that works fine but it gives all of the elements one by one..

What I want to do is extract just one set such as "H1" or "li" you get the idea.. I tried using the If statement but it fails..

Can someone point me to the correct command...

And then once I get all the "H1" if there is more than one can I pick it with something like.

if $oElement.tagname(2) = "h1" then msgbox(0, "", $oElement.innerText)

By adding say a 2 to get the 3rd H1 tag... 0,1,2

Edited by tommytx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...