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

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

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

Post 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.... :)
Last edited by dreamline on Sun Aug 07, 2005 5:16 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what's the code you are using to do the rollover?
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

Post 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... :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

..and the javascript for MM_swapImgRestore() and MM_swapImage(), please.
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

Post 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>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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);">
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

Post by dreamline »

Thank you for your quick answer feyd.. :)
i'll give it a go.. :)
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

Post by dreamline »

Did try the id thing but didn't have any luck.. :( So my problem still stands.. :)
Post Reply