View Full Version : How do I get 2 scripts to work on a page? Newbie here!!

10-19-2005, 07:09 PM
Hi there this is my first post!!

I have 2 scripts which I need to use on my webpage. Both scripts use the "window.onload=changecontent" command and this is causing a conflict between them.

I am aware that I can remove the "window.onload=changecontent" command and put it into the "<body onload="something1();something2();"> event to stop conflicts, but how do get both to work when the "window.onload=changecontent" is the same for both scripts? I know I can't do "<body onload="changecontent();changecontent();">

Any help would be greatly appreciated and this is my first post :)

Philip M
10-19-2005, 07:38 PM
Welcome to the forum.

You cannot have duplication of function or variable names between the two scripts.

So you must rename the functions in the second script to something like:-

"<body onload="changecontent1();changecontent2();">
and similarly all the variables.

But if the function changecontent() is identical why are two scripts needed? You might as well amalgamate or combine the two scripts into one.

10-19-2005, 08:14 PM
The two scripts for a horizontal scrolling banner and a menu, so they are different but both have the same "window.onload=populate" so I cant enter "populate" twice into the body script can I? Can I put populate1 and populate2?

Sorry but Im really trying hard to get to grips with it all!!