PDA

View Full Version : Cross-browser menu problem


DaveRainsberger
12-09-2002, 03:06 PM
Why won't my drop down menu work in any Netscape browser?
It works perfectly in IE

Here is a simple code I used for a test:

<html><head><title>Menu</title>

<style type="text/css">
#Cell1 { position:absolute;visibility:visible;top:0px;left:0px; }
#Menu1-1 {
#Menu1 { position:absolute;visibility:hidden;top:0px;left:0px; }
#Menu1-1 { position:absolute;visibility:hidden;top:20px;left:40px; }
#Menu1-2 { position:absolute;visibility:hidden;top:40px;left:40px; }
#Menu1-3 { position:absolute;visibility:hidden;top:60px;left:40px; }
#Menu1-4 { position:absolute;visibility:hidden;top:80px;left:40px; }
</style>

<script language="javascript">

browser = navigator.appName;
browserNum = parseInt(navigator.appVersion);

if((browser == "Netscape") && (browseNum < 5)) {
layerRef = "document.layers['";
endLayerRef = "']";
styleRef = "";
}
else if((browser == "Netscape") && (browseNum >= 5)) {
layerRef = "document.getElementById('";
endLayerRef = "')";
styleRef = ".style";
}
else { layerRef = "document.all['";
endLayerRef = "']";
styleRef = ".style";
}

function showMenu(menuNum) {
eval(layerRef + "Menu" + menuNum + endLayerRef + styleRef + ".visibility = 'visible'");
}

function hideMenu(menuNum) {
eval(layerRef + "Menu" + menuNum + endLayerRef + styleRef + ".visibility = 'hidden'");
}

</script></head>

<body bgcolor=black text=white marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 link=green vlink=green alink=yellow>

<table border=0 cellpadding=0 cellspacing=0><tr>
<td width=150><div id="Cell1" onmouseover="showMenu('1')" onmouseout="hideMenu('1')"><b>Menu 1</b>
</div></td></tr></table>

<div id="Menu1" onmouseover="showMenu('1')" onmouseout="hideMenu('1')">
<b>Menu 1</b><br>

<a href="" onmouseover="showMenu('1-1')" onmouseout="hideMenu('1-1')">Hello Menu 1-1</a><br>
<a href="" onmouseover="showMenu('1-2')" onmouseout="hideMenu('1-2')">Hello Menu 1-2</a><br>
<a href="" onmouseover="showMenu('1-3')" onmouseout="hideMenu('1-3')">Hello Menu 1-3</a><br>
<a href="" onmouseover="showMenu('1-4')" onmouseout="hideMenu('1-4')">Hello Menu 1-4</a>
</div>

<div id="Menu1-1" onmouseover="showMenu('1-1');showMenu('1')" onmouseout="hideMenu('1-1');hideMenu('1')">
<b>Menu 1-1</b><br>Hello<br>Hi<br>Goodbye<br>Bye
</div>

<div id="Menu1-2" onmouseover="showMenu('1-2');showMenu('1')" onmouseout="hideMenu('1-2');hideMenu('1');hideMenu('1')">
<b>Menu 1-2</b><br>Hello<br>Hi<br>Goodbye<br>Bye
</div>

<div id="Menu1-3" onmouseover="showMenu('1-3');showMenu('1')" onmouseout="hideMenu('1-3');hideMenu('1')">
<b>Menu 1-3</b><br>Hello<br>Hi<br>Goodbye<br>Bye
</div>

<div id="Menu1-4" onmouseover="showMenu('1-4');showMenu('1')" onmouseout="hideMenu('1-4');hideMenu('1')">
<b>Menu 1-4</b><br>Hello<br>Hi<br>Goodbye<br>Bye
</div>

</body></html>

PauletteB
12-09-2002, 04:04 PM
browserNum = parseInt(navigator.appVersion);

if((browser == "Netscape") && (browseNum < 5)) {

else if((browser == "Netscape") && (browseNum >= 5)) {


Typo... Should be the same

browseNum
browserNum

DaveRainsberger
12-09-2002, 04:20 PM
ah HAH! Don't I feel sheepish. Thanks a lot.

One more question, though: Now it works in NS6 and IE6, but not in NS4. Should it work or should I just give up trying?

Roy Sinclair
12-09-2002, 04:35 PM
Netscape 4 will never work with what you've got. You'd have to start over and rewrite it to work with Netscape 4. It's not worth the effort unless you know you'll have a lot of NS 4 users, otherwise just try to let it degrade gracefully for NS 4 users instead.

DaveRainsberger
12-09-2002, 04:44 PM
hmmmmmm....

From what I have read, more and more people are getting mad about how large and slow NS6 is and are going back to NS4. I prefer IE6 myself but then don't all web designers prefer IE?

Roy Sinclair
12-09-2002, 04:55 PM
More and more people? Anybody who has the choice and makes NS 4 their choice deserves what they get. I'm more concered about the users who don't have a choice and NS 4 is all they have, those people deserve some consideration but still the web can't wait around for whoever is preventing them from advancing to finally see the light. Try to make your page work the same for a NS4 user as it would for a user who has scripting disabled (which is definitely something you should keep in mind).

cg9com
12-09-2002, 05:19 PM
Originally posted by DaveRainsberger
don't all web designers prefer IE?

thats an intresting question, i always MAKE my pages in IE, but of course make sure they are still crossbrowser ...
what makes you think that most users do that?

brothercake
12-09-2002, 05:23 PM
I read and heard similair things around a year ago - ns4 users trying ns6 and being disappointed with it (or at least, with their web experience using it, which for most users amounts to the same thing) and so went back to ns4.

But that was months ago. The gecko engine is now perfectly stable - I've not heard of any disgruntled netscape 7 users .. well not in relation to that anyway (inability to turn off pop-ups while requested windows still can't open, anyone?) Possibly (probably?) the bad PR from ns6 has hit ns7 uptake unfairly, and opinions towards netscape in general remain based on the poor performance of its elder siblings.

Among web developers, you will find a much higher proportion of non-IE users, compared with surfers in general.

DaveRainsberger
12-09-2002, 05:31 PM
"Among web developers, you will find a much higher proportion of non-IE users, compared with surfers in general."

My thinking exactly