Solved

Alternative to document.getElementsByTagName

Posted on 2001-06-25
2
898 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

752 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