Solved

Alternative to document.getElementsByTagName

Posted on 2001-06-25
2
887 Views
Last Modified: 2012-08-14
Is there an alternative to getElementsByTagName that works uniformly for browser versions 4 and uPwards upto version 6 for both IE and NETSCAPE.

Semms getElementsByTagName will work only for browser versions 5 and upwards
0
Comment
Question by:x666xchange
2 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 30 total points
ID: 6224005
there is no uniform way of accomplishing that.

in Netscape you can only do it for layers:
myarray = document.layers

in IE you can use:
document.all.tags("DIV")
or any other kind of tag

in IE 5 + and NS 6 you can use
document.getElementsByTagName("DIV")

regards,
CJ
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6225728
I'm really trying to support that tag in the new sites I'm working on...

that and document.all

those are the two best ways of getting elements in my opinion, and although ns4 makes you jump through hoops to get some elements..I'm hoping that this trend towards a univeral way to access an element is going to develop to a standard ! yes!

anyways, if you are having a problem with getting at something in ns4, then let us try and help, otherwise, if you are just frustrated, welcome to the club.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question about traversing a tree using jQuery 7 34
Create an automated page index 9 51
Javascript the "if condition with Or" 8 29
ASP.NET Content Page 3 29
This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question