Jump to content

IE: How to call .getElementsByClassName() <specific element here>.innerhtml inline


Recommended Posts

Posted

I know most IE objects that are collections (arrays) let you specify the element inline
consolewrite( $oElement.children(0).innerhtml &@CRLF)
However getElementsByClassName takes a peram, so I don't know how to make autoit understand what element of it i want to use when I try to use it inline. These are things I tried that all fail:
consolewrite( $oElement.getElementsByClassName("classnamehere")(0).innerhtml &@CRLF)
consolewrite( $oElement.getElementsByClassName("classnamehere").(0).innerhtml &@CRLF)
consolewrite( $oElement.getElementsByClassName("classnamehere",0).innerhtml &@CRLF)


The following code works, but is multi-line, and I want to avoid the use of a temp var
$temp = $oElement.getElementsByClassName("classnamehere")
ConsoleWrite("x:"&$temp(0).innerhtml)

Is there any way to call .getElementsByClassName() inline without throwing syntax errors, or do I HAVE to use temp vars?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

.getElementsByClassName is a function that returns collection so you cant use it like that. Depending on the HTML element and code , it may be done another way. Post the html code.

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
  • Recently Browsing   0 members

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