Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

layer, divs, whatever!

netscape 6 dont like my javascript

3:24 pm on Dec 3, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 6, 2002
votes: 0

OK if anyone can help me with this I'll be eternally grateful!
I'm using some dhtml on the front page of a site so that when you roll over a link, some text appears on another part of the page, so you get a brief introductory paragraph before you decide to go to the page in question.
Amazingly enough this sort of works in Netscape 4.7 (and N4.8 on the mac) as well as all versions of IE I've tested but not at all on Netscape 6.2! The code is fairly hacked to pieces at this stage but I've got rid of a lot of extraneous stuff,
anyway here's the javascript

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }

and then when on the 'a href' there's a:
onMouseOver="MM_showHideLayers('textlayer1','','show','textlayer2','','hide', ...etc.

the text layers themselves are divs with visibility 'hidden' except for the initial paragraph which is 'on' (ie 'visible') when you load the page,
not sure if any of this will be left when I post this but anyones ideas would be most welcome...
now my only problem is getting those absolutely placed divs to work in my fluid layout!

[1][[b]edited by[/b]: tedster at 3:45 pm (utc) on Dec. 3, 2002][/1]
[1][edit reason] turn off smilies [/edit][/1]

3:44 pm on Dec 3, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Sept 1, 2001
votes: 0

Well, the first thing I would recommend is getting rid of the Macromedia stock javascript for rollovers. It's bloated, and it eats up resources because it build arrays of every object on the page.

If you search through these forums, you'll find lots of very clean and simple javascripts for rollovers.

You can even use CSS for rollovers, which apparently is even cleaner.

Netscape 6.2 should support Javascript without a problem, but the MM code could be causing problems.