I faced some problem with the rollover images. I have used some images from Flickr.
What I wanted to achieve:
When user clicks on the first image, it will displayed the second image(the first image will disappear). Then when user rollovers to the second image, it will display a closeup.
The problem I faced:
When I click on the first image, the second image does appear, but when I rollover to the second image, the closeup doesn't display.
Following is the code:
-----------------------------------------------------
<html>
<head>
<title>Untitled Document</title>
<script type="text/JavaScript">
<!--
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_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) { //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[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].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[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onLoad="MM_preloadImages('photo_R.jpg')">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="main"><a href="#" onClick="document.getElementById('main').innerHTML=document.getElementById('try').innerHTML"><img src="http://farm3.static.flickr.com/2011/2391625012_2b6446b933_m.jpg"/></a></td>
</tr>
<tr>
<td id="try" style="display:none">
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('try','','http://farm1.static.flickr.com/170/402169833_bfae7b29e7.jpg?v=0',1)"><img src="http://farm1.static.flickr.com/165/402169757_d511f16004.jpg?v=1232336072" name="try" border="0" id="try" /></a></td>
</tr>
</table>
</body>
</html>
-------------------------------------------------------
What I wanted to achieve:
When user clicks on the first image, it will displayed the second image(the first image will disappear). Then when user rollovers to the second image, it will display a closeup.
The problem I faced:
When I click on the first image, the second image does appear, but when I rollover to the second image, the closeup doesn't display.
Anyone knows what could be the problem? Thanks.