PDA

View Full Version : Multiple JavaScripts on one page


jaimehill
03-16-2005, 11:06 AM
I'm trying to run several scripts on one page. And when I test them, all but one work. I'm trying to run a scrolling ticker in one box (section of table) and another which rotates images (with associated URLs). The one which isn't working is the second one.

When I remove the scripting and add it to another page, it works fine, but I'm not sure what the problem is when the scripts are located on the same page - can anyone help?

I'm not an expert by any stretch of the imagination, so can't pinpoint the problem. Any help would be gratefully received as I'm starting to tear my hair out now!

Many thanks :)

I can mail the code if necessary

_Aerospace_Eng_
03-16-2005, 11:47 AM
why mail the code? just post the code using the [-code][-/code] tags (without the dashes) and then we can help you, im thinking that there are multiple onloads trying to run which is causing one of them not to work

jaimehill
03-16-2005, 11:55 AM
The code is too long to post, even if I remove the meta tags and CSS... Can you suggest any other alternatives - I could probably remove some other stuff, but it might be that which is the problem

_Aerospace_Eng_
03-16-2005, 12:13 PM
then put the html file with the code on it, then use the upload feature to upload it to one of your posts

jaimehill
03-16-2005, 12:16 PM
Here you go

_Aerospace_Eng_
03-16-2005, 12:48 PM
yes as i suspected, two onloads, okay try doing this find this line in the first script, delete it
window.onload=start_slider
and add this to your open body tag
onload="start_slider();
then find this line in the 2nd script, delete it
window.onload=start_ticking
and add on to the what i already told to add in the open body tag, this
start_ticking;"
so your body tag should look like this
<BODY onload="start_slide();start_ticking();">
see if that works

jaimehill
03-17-2005, 04:25 AM
You are a superstar! :D

I knew it would be something like that, but didn't really know where to start.

All working! Thanks so much!:D