forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Gazab on March 21, 2007, 12:59:05 am

Title: JavaScript conflict?
Post by: Gazab on March 21, 2007, 12:59:05 am
Hi,

I have recently added FrontPage buttons to my sub menu navigation. We have noticed that this could be giving some kind of JavaScript conflict and now we cannot view our images full size!

I know the obvious solution is to change the buttons but I really would like to keep them.

Any ideas on how I may resolve this would be much appreciated.

Thanks
Title: Re: JavaScript conflict?
Post by: Nibbler on March 21, 2007, 01:01:01 am
Post a link and review the FAQ.
Title: Re: JavaScript conflict?
Post by: Joachim Müller on March 21, 2007, 09:21:12 am
Did you use the wannabe-editor MS Frontpage to edit Coppermine files? You mustn't. Frontpage is notorious to "beautify" code in a way that actually destroys the file.
Title: Re: JavaScript conflict?
Post by: Gazab on March 21, 2007, 10:58:21 am
Hi Gau GAu,

Thanks for your advice….I am not an authority on editors so cannot really comment on the strengths or weaknesses of either FrontPage or, say, Dreamweaver.
I will take on board your comments and look at making the change over to the preferred option. It’s something I’ve been meaning to do for a while but its easier working with what you know….
Here is the piece of JavaScript that FrontPage generated for its buttons. I use the same piece of script within my forum environment and don’t appear to have any problems there!

Code: [Select]
<script language="JavaScript">
<!--
function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}
// -->
</script>

I guess I'll have to live with this short term.
Title: Re: JavaScript conflict?
Post by: Nibbler on March 21, 2007, 11:05:41 am
No reason to live with it, do as suggested and post a link.
Title: Re: JavaScript conflict?
Post by: Gazab on March 21, 2007, 11:16:07 am
Nibbler, Gau Gau,

Please forgive me....I have taken another look and discovered that I must have deleted the existing Script line for scripts.js!
Needless to say we are working again now. ;D

Many thanks for your help and advise, Coppermine is a great piece of work....