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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.all in Netscape 1

Status
Not open for further replies.

kimb

Technical User
Jun 30, 2002
39
NZ
I have a navigation menu with javascript. There are a number of lines which mention document.all and I've been told that this can only be read by Internet Explorer.

Does anyone know if there is any way I can get Netscape to read my menu??
 
If these "document.all" are not alone (if it's "document.all.tagId" or "document.all('tagId')"), replace them with "document.getElementById("tagId"). Beware that document.all may accept name attribute as ident for a tag, the "document.getElementById" function only accept id attributes. Water is not bad as long as it stays out human body ;-)
 
I give a star to Targol. Good information here. Id's are the best and only way I recommend since it is the standard compliant way of doing things as set by the W3C.org

I use this way to upgrade the old Internet Exploder browsers that only understand document.all

if(document.all && !document.getElementById)
{
document.getElementById = function(id)
{
return document.all;
}
}

Adding that snippet at the top of your page makes you only have to deal with one set of functions instead of two in the rest of your page. Always reference an item by it's ID! :) Gary Haran
 
I'm sorry I have a little mistake in my code here is the corrected version :

if(document.all && !document.getElementById)
{
document.getElementById = function(id)
{
return document.all[id];
}
}
Gary Haran
 
"I give a star to Targol" : promises, promises LOL LOL LOL Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top