View Full Version : Two JS codes in one page, only bottom working

12-16-2010, 08:20 AM
I am trying to use these two js codes in one page:



They both work perfectly fine except when both linked up at the same time. Only the last one will work. I've tried to find how the codes are working when the page loads in order to fix that problem but I cant figure it out for these two specific codes.


Philip M
12-16-2010, 09:15 AM
This has been covered very many times in this forum.

There are three reasons which two scripts on the same page may conflict:-

a) Multiple onload statements. See:-
Or to resolve you can simply fire a set of functions when the page loads.

<script type="text/javascript">
window.onload = function() {
b) Duplicate function and/or variable names in the scripts - the second instance will overwrite the first.
c) Using two or more different Javascript frameworks.

"If you think education is expensive, try ignorance." - Derek Bok (1930-), Harvard University President

12-16-2010, 09:23 AM
Thanks for responding.

I have tried entering that code already to see if that would work and it didn't help. I also tried to figure out those last two scenarios but I haven't been able to.

If anyone could point me in the right direction as far as the two specific sources I posted, that would be amazing.

Thanks again

Philip M
12-16-2010, 09:37 AM
If you use the search feature of this forum for "lightbox" you will find that the same problem has arisen several times before - and a satisfactory solution has not been found.