PDA

View Full Version : JavaScript issue Firefox and IE compliancy



jcatalfa
25 Feb 2010, 09:17 AM
I have tried all I know to make this script work in Firefox it works in IE 6 and 7. Is there a fix or some other way to make a link on this thumbnail work.

What I want to do is have a small image on one location and have the image change in another. I not a pro with javascript so please speak with small words.

<img src="thumbnails/_MG_0027.jpg" alt="" onclick="document.all.large.src='images/_MG_0027.jpg'">




<script type="text/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_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_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;
}
</script>

jcatalfa
26 Feb 2010, 05:17 PM
Well I found the solution on my own and it's a simple fix. At first I was going to make a gorup of image maps that opened in an Iframe but it's a pain to have to make so many pages. And Frames are crap!!! So I decided to use lightbox2.04 and the concept is good but the amount of code is well, extream. However the best part is you don't have to do to much with the code to make it work for you . With a bit of CSS I think it will work fine. The site in question has a flash version and I am making the static version. http://www.thepicturepair.com