PDA

View Full Version : how to get more than one script to work properly on one page



landrocket
05-25-2006, 11:22 PM
Could anyone please help me with this. I have two scripts on a single page but only one seems to work. I am new to this and would appreciate any help I can receive.
Thx

jscheuer1
05-26-2006, 03:58 AM
Here is what I often recommend folks look into:


See this tutorial (http://www.javascriptkit.com/javatutors/multiplejava.shtml) for one possible solution.

Aside from the tutorial above, which usually is the solution when the problem is two different scripts, you may need to consult:

http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=0&TOshow=allshow#refcon

Which explains how two scripts on the same page may not use the same set of variable names, id names, function names, etc. This is especially important if the problem is two copies of the same script on a page but, can come into play with two different scripts when the first step (tutorial) won't fix it.

One other approach that works in both situations, if adaptable to one (or more) of the scripts, is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.