problem to show a div on Netscape

T

Telemak

Hello,


I've got a trouble with my script, i want to show a <div> on Netscape
and it doesn't work:

Here is the script


//navigators identification

var ie4=(document.all && !document.getElementById)? true:false
var ie5=(document.all && document.getElementById)? true:false
var n4=(document.layers)? true:false
var n6=(!document.all && document.getElementById)? true:false

// creation of three div

var links=3;
var floatinglinks=new Array("Flats", "leisures", "Rate");

//function which hides all the div

function menu(number)
{



for (i=0; i<links;i++)
{
if(ie4||ie5)
{

document.all[floatinglinks].style.visibility="hidden";
}

else if(n4)
{

document.layers[floatinglinks].visibility="hide";
}

else if(n6)
{

document.getElementById[floatinglinks].style.visibility="hidden";
}
}

// showing the div thanks to "number"

if(ie4||ie5)

{
document.all[floatinglinks[number]].style.visibility="visible";
}

if(n4)
{
document.layers[floatinglinks[number]].visibility="show";
}

if(n6)
{
document.getElementById[floatinglinks[number]].style.visibility="visible";
}

}

</script>

******************* end of the script**********************


Then in the body:

Access to the function in the menu with "onclick"

<td>&nbsp;<img src="images/bouton_off.jpg" id="bouton_1" alt="flats"
title="flats"/>&nbsp;<a id="flats" class="orange" href="#"
onclick="menu(0)">Flats</a></td>

One on the div to show


<div id="flats" style="position:relative; z-index:2; left:106px;
top:-395px;
width:250px; height:150px; visibility: hidden;">
<!--contenu-->
</div>


Here is the probleme the div doesn't work on Netscape and the
Javascript console says :

document.getElementById[floatinglinks] has no properties

What should i change in the script or in the body ?

Thanks for your answers !


Telemak.
 
C

Csaba Gabor

I haven't looked at your code at all, except to note that
you have two different capitalizations for Flats/flats.
var floatinglinks=new Array("Flats", "leisures", "Rate");
<div id="flats" style="position:relative; z-index:2; left:106px;
top:-395px;
width:250px; height:150px; visibility: hidden;">

HTH,
Csaba Gabor
 
G

gui bus

Ok there is a big mistake but even i change the Flats into flats it
doesn't work anymore.

What should i do ?

thanks for your answer .
 
G

gui bus

Ok there is a big mistake but even i change the Flats into flats it
doesn't work anymore.

What should i do ?

thanks for your answer .
 
T

Telemak

Thanks for your help Mike, with parenthesis it works perfectly !!

Sincerly

guillaume.

Telemak said:
Hello,
I've got a trouble with my script, i want to show a <div> on Netscape
and it doesn't work:
<snip>
document.getElementById[floatinglinks[number]].style.visibility="visible";
^ ^
document.getElementById(floatinglinks[number]).style.visibility="visible";
use parenthesis, not square brackets, with getElementById(...)

<div id="flats" style="position:relative; z-index:2; left:106px; top:-395px;
width:250px; height:150px; visibility: hidden;">

Are you sure the div will be visible with "top:-395px;", maybe for
testing purposes set top:0; left:0; you've got things working.

Good Luck,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top