...

View Full Version : 2 javascripts not working in 1 page.



utsav
05-20-2009, 05:37 AM
I need two or more javascripts in one page. But the problem is that when i put one or more javascript only the last one works while others donot work. But when single all work fine. What could be the problem?

TinyScript
05-20-2009, 06:24 AM
try to combine the init() functions that define the two scripts into one new init(). Use alerts in each step to see where the eroor is coming from.

adios
05-20-2009, 07:11 AM
Or ... look for one (or all) of these:

window.onload = something;
onload = something;
<body .... onload="something()">

All are the same; they refer to a variable called 'onload.'
Only one per customer.

Read this (http://www.dyn-web.com/tutorials/combine.php).

bigtiger
05-20-2009, 07:21 AM
Hmmm...
This may also work but should be used when none of works
ie, document.attachEvent
ff, document.addEventListener

these will allow attach more than one even handler on a page.

Philip M
05-20-2009, 08:15 AM
http://www.javascriptkit.com/javatutors/multiplejava.shtml

It should be mentioned that another possible problem is duplication of one or more function and/or variable names between the two scripts.

utsav
05-20-2009, 12:12 PM
Thanks every body. I'll go thru all of ur steps and let u know what happened.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum