Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to enum document elements?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I know this way:
dim oElement
for each oElement in document.all
if oElement.tagName = "INPUT" then
...
end if
next

but it doesn't work with:
set oElement = document.all("txt1") ???
 
I've solve this:
if IsObject(document.all(xxx)) then
set oElement = document.all(xxx)
end if
 
I believe it returns a collection (HTML) only if more that 1 is found else it is a string
" If this parameter is a string and there is more than one element with the name or id property equal to the string, the method returns a collection of matching elements."

Try
set oElement = document.all("txt1",0) ' return first element or NOTHING Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top