X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Why if i put ANY javascript on product.tpl it prevents all other javascripts? (https://forum.x-cart.com/showthread.php?t=52098)

Christofer 02-02-2010 05:15 AM

Why if i put ANY javascript on product.tpl it prevents all other javascripts?
 
Hello there, i have a problem (many months ago) but i just released it. In the past i tried to add lightbox to use it on some products. The problem was that when i was adding the lightbox it was preventing the other javascripts from functioning. E.g the prices were not changing if the user choosed an option that has to modify the price.

Qualiteam told me that it was a conflict with the lightbox so i left it. Before a few days i added a script which is:
Code:

window.onload=show;

function show(id) {
var d = document.getElementById(id);
        for (var i = 1; i<=20; i++) {
                if (document.getElementById('answer_q'+i)) {document.getElementById('answer_q'+i).style.display='none';}
        }
if (d) {d.style.display='block';}
}


but even with that code i have again the same problems. Even if i added it with external .js. Any ideas what's going on?

gb2world 02-02-2010 11:12 AM

Re: Why if i put ANY javascript on product.tpl it prevents all other javascripts?
 
If you are having issues with several javascript initializations conflicting with each other - you might find the methods described here useful: http://www.dyn-web.com/tutorials/combine.php

Christofer 02-02-2010 12:22 PM

Re: Why if i put ANY javascript on product.tpl it prevents all other javascripts?
 
thank you, ill check it but basically qualiteam told that it was a conflict with the lightbox coz of the sign $, but i believe that they are not true because:
1. on many xcart sites i saw lightbox
2. the problem appears with ANY javascript i add, so i don't think it has to do with the code that the javascripts i add, but with the javascript at all..


All times are GMT -8. The time now is 04:08 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.