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

How to access divs in Netscape 6

Status
Not open for further replies.

RemoteSilicon

Programmer
Feb 13, 2001
45
0
0
GB
Hello
I am trying to hide a div say div7 in Netscape 6. It works fine with IE with the syntax :

document.all.div7.style.visibility = "hidden";

It neither gives me an error in NS6 nor hides the div.
Plz. can anyone help me.
 
in Netscape 6 u can use :
document.getElementById("div7").style.visibility = "hidden";
 
the two Document Object Models are different. Mozilla uses the standard one as set by and I recommend that you start using that one (it works with newer browsers).

to access a div use document.getElementById(id) and if you want to have support for older IE you can simply have this inserted before all your code :

if (!document.getElementById)
{
document.getElementById = function(id)
{
return document.all[id]
}
}

document.getElementById('div7').style.visibility = "hidden";

I hope this helps. Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top