View Full Version : Two javascripts on one page?

07-11-2002, 07:31 PM
Hi there,
Could someone please help me - I am trying to put more than one javascript on one page and they just don't seem to like each other - only one works.
Is there a special function I need to put it to enable them to work alongside each other?:confused:
Thanks for any help

Soldier Bob
07-11-2002, 07:36 PM
are you including any .js files? or placing the code in the .html file itself?

as long as the function names are different then they should be ok.

do both work separatly? I am wondering if one of the scripts is broken.

In javascript if there is any problems in any of the scripts you can have the whole thing not work.

-S. Bob

Philip M
07-11-2002, 07:42 PM
You can have as many scripts as you want.

Have a look at:-


In short, the idea is

onload=" dothis(); dothat(); dotheother;"

that is, separating with semi-colons.

07-11-2002, 07:54 PM
this info is inherent in the previous posts but i just thought it might help to stress it:
if the two scripts don't have any naming conflicts, then making sure that in the header section, there's a semicolon at the end of the first script is often all it takes to make them both work.

07-11-2002, 10:49 PM
Thanks all of you - I've taken all your comments in hand and I'm double checking functions, variables etc - and all the other fun stuff you all suggested!
Thanks so much for your speedy and very helpful replies!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum