By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

problem to show a div on Netscape

P: n/a
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[i]].style.visibility="hidden";
}

else if(n4)
{

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

else if(n6)
{

document.getElementById[floatinglinks[i]].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[i]] has no properties

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

Thanks for your answers !
Telemak.
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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
Jul 23 '05 #2

P: n/a


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 .

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

P: n/a


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 .

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4

P: n/a
Telemak wrote:
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(...)

<snip>
<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

Jul 23 '05 #5

P: n/a
Hi,
Which Netscape? 4.x or 6?

For older Netscape you'll have to write <layer></layer>.
<div></div> doesn't get a look at <div></div>.

I cretaed a js file
http://www.caoxuan.com/cxk/webart/goodies/laydiv.js
Just to modify the layers and divs for different objects.
http://www.caoxuan.com/cxk/webart/go...ndexDhtml.html

Kien


gui bus <bu*****@free.fr> wrote in message news:<40*********************@news.frii.net>...
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 .

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #6

P: n/a
mscir <ms***@access4less.com.net.org.uk> wrote in message news:<10*************@corp.supernews.com>...

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

Sincerly

guillaume.

Telemak wrote:
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(...)

<snip>
<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

Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.