PDA

View Full Version : Works In Netscape 4.7 but not 7.0?


Crash1hd
01-08-2003, 09:46 AM
Ok Why is it that the following script works in Netscape 4.7 but not 7.0 and also doesnt work in Mozilla (even thought I here it is better?) any ideas it also works in Opera and All flavours of I.e. That I can check! 5 and 6

<HEAD>
<STYLE type="text/css"><!--
#image1 { position: absolute; top: 0; left: 0; width: 400; visibility: visible; }
#image1a { position: absolute; top: 25; left: 25; width: 150; visibility: hidden; }
#image1b { position: absolute; top: 25; left: 225; width: 150; visibility: hidden; }
--></STYLE>

<SCRIPT LANGUAGE="JavaScript"><!--
if (document.layers)
var doc = 'document.', vis = '.visibility';
if (document.all)
var doc = 'document.all.', vis = '.style.visibility';

function show(object) {
if (document.layers || document.all)
eval(doc + object + vis + ' = "visible"');
}

function hide(object) {
if (document.layers || document.all)
eval(doc + object + vis + ' = "hidden"');
}

function hideAll() {
hide('image1a');
hide('image1b');
}
//--></SCRIPT>

</HEAD>

<BODY>

<MAP NAME="image-map1">
<AREA SHAPE="RECT" COORDS="0,0,400,25" href="#" onMouseover="hideAll()">
<AREA SHAPE="RECT" COORDS="0,25,25,375" href="#" onMouseover="hideAll()">
<AREA SHAPE="RECT" COORDS="25,25,174,375" href="#" onMouseover="hideAll();show('image1a')">
<AREA SHAPE="RECT" COORDS="175,25,225,375" href="#" onMouseover="hideAll()">
<AREA SHAPE="RECT" COORDS="225,25,375,375" href="#" onMouseover="hideAll();show('image1b')">
<AREA SHAPE="RECT" COORDS="375,25,400,375" href="#" onMouseover="hideAll()">
<AREA SHAPE="RECT" COORDS="0,375,400,400" href="#" onMouseover="hideAll()">
</MAP>

<DIV ID="image1">
<IMG SRC="image.gif" BORDER="0" WIDTH="400" HEIGHT="400" USEMAP="#image-map1" onMouseout="hideAll()">
</DIV>

<MAP NAME="image-map2">
<AREA SHAPE="RECT" COORDS="0,0,200,199" HREF="page2a.html">
<AREA SHAPE="RECT" COORDS="0,200,200,400" HREF="page2b.html">
</MAP>

<DIV ID="image1a">
<IMG SRC="image1.gif" BORDER="0" WIDTH="150" HEIGHT="350" USEMAP="#image-map2" onMouseout="hideAll()">
</DIV>

<MAP NAME="image-map3">
<AREA SHAPE="RECT" COORDS="0,0,200,199" HREF="page3a.html">
<AREA SHAPE="RECT" COORDS="0,200,200,400" HREF="page3b.html">
</MAP>

<DIV ID="image1b">
<IMG SRC="image1.gif" BORDER="0" WIDTH="150" HEIGHT="350" USEMAP="#image-map3" onMouseout="hideAll()">
</DIV>

</BODY>
</HTML>

Algorithm
01-08-2003, 09:58 AM
Netscape versions 6 and 7 do not support document.layers. Instead, they support document.getElementById. You'll need to add an additional check for document.getElementById in your code, like so:

if (document.getElementById)
var doc = 'document.getElementById(\'', vis = '\').style.visibility';

Please note, however, that several versions of Internet Explorer also support document.getElementById, so you will need to employ an if/else clause instead of just several 'if's to avoid runtime errors.

ijoer316
08-26-2005, 09:32 PM
What if i have a drop down menu (menu1) and several other hidden drop down menus (menus2,3,4,5 and so on) and whatever you pick from menu1 would make a new menu appear.

So if i pick option #1 from menu1, it would make menu2 appear.

Is there a way to do this in Netscape4.7?

I haven't been able to get it to work at all.

I tried modifying your script above but not alot of luck with it.

Rob