PDA

View Full Version : Calling two function with body onLoad



rajug
01-29-2007, 06:09 AM
Hello all,

How can i call two functions with body onLoad event? Suppose i would like to call two ajax functions to load default data with abc() and xyz() functions in my onLoad event of body. I have done simple as calling two functions like this:


onLoad="abc();xyz();"

Am i wrong? Can anyone tell me?

With Regards

djr33
01-29-2007, 09:14 AM
Sure. There might be problems if they overlap/relate too much.... if the variable names are the same, etc. In general, though, that shhould be all you need.
You could also do:

onLoad="hostfunction();"

in the script--
function hostfunction() {
abc();
xyz();
}

That might be nice if you wanted to run a bunch of functions.

mburt
01-29-2007, 11:02 AM
Or if you really wanted to: (in the head section):


window.onload = abc;xyz

Twey
01-29-2007, 02:48 PM
window.onload = abc;xyzNo, that would break. You probably mean:
window.onload = function() { abc(); xyz(); };