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> <img src="images/bouton_off.jpg" id="bouton_1" alt="flats"
title="flats"/> <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.
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> <img src="images/bouton_off.jpg" id="bouton_1" alt="flats"
title="flats"/> <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.