PDA

View Full Version : netscape help with layers


kamarthi7
04-29-2003, 02:52 PM
hello,

Is there any way to get the elements ID or name in a function, which can run in netscape 4.x. like we can use getElementById in IE. :rolleyes:

I just want to pass the div tags ID to a function where the display and hide code is writen.

for example

<a href="javascript: void(null);" onclick="openClose('div1')">click</a>

<div id="div1">some text here</div>

and in the function

openclose(ID)
{
document.getElementById(ID).style.display = "block";
}

but how to put a code such that it even works in Netscape 4.x.

the below link will show how the div tags toggle. it even works is netscape.
http://www.citibank.de/germany/service/hilfe/2_1.asp

if u have any idea please help me.

tamienne
04-29-2003, 02:59 PM
you can use document.layers[ID] you still need to do the check to see if it's NS4 or not before you use that code though..

if (document.layers) {
document.layers[ID]....