Page 1 of 1

[solved]IE and NS input type and rollover images.

Posted: Wed Jun 09, 2004 3:43 am
by dreamline
Hi there,
I am using an input type image with rollover images. However there's a problem when showing in Netscape. The image doesn't rollover.. I've read some things on google but haven't found a clear solution for this problem.

Anyone have a similar problem?

Thanks.... :)

Posted: Wed Jun 09, 2004 3:49 am
by feyd
what's the code you are using to do the rollover?

Posted: Wed Jun 09, 2004 6:11 am
by dreamline
I'm doing the standard rollover routine, here's the example i'm using:

<input name="Home" type="image" src="images/menus/home.jpg" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/menus/homeshadow.jpg',1)" alt="Home" width="52" height="31" onClick="menu(0);">

When i'm using a href then i won't be able to use the onclick event.. :(

Hope this clarifies my problem though... In IE it works smoothly, however NS only shows the home.jpg... :(

Posted: Wed Jun 09, 2004 6:22 am
by feyd
..and the javascript for MM_swapImgRestore() and MM_swapImage(), please.

Posted: Wed Jun 09, 2004 6:47 am
by dreamline
Here the remaining code i'm using.. :)

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}

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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}

function MM_findObj(n, d) { //v4.01
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[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); 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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

Posted: Wed Jun 09, 2004 6:52 am
by feyd
in netscape and mozilla it's looking for a object with the 'home' id.. i.e.:

Code: Select all

<input id="home" name="Home" type="image" src="images/menus/home.jpg" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/menus/homeshadow.jpg',1)" alt="Home" width="52" height="31" onClick="menu(0);">

Posted: Wed Jun 09, 2004 6:59 am
by dreamline
Thank you for your quick answer feyd.. :)
i'll give it a go.. :)

Posted: Thu Jun 10, 2004 12:42 am
by dreamline
Did try the id thing but didn't have any luck.. :( So my problem still stands.. :)