Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner


Developer Channel

FlashKit.com
JavaScriptSource
Developer Jobs
ScriptSearch
WebDeveloper.com
Webreference
HTMLGoodies
HTML5 Dev Center
Developer.com
jGuru.com
PHPBuilder

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Need to load several functions after the page loads? Use this snippet to call several functions using the onLoad event handler. Easy to use.


Notes

See the notes at: "Executing JavaScript on Page Load"

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: multipleOnload.js and load it last. Or, if you use one file for several scripts, you can add it to the bottom of page.


Head

Paste this code into the HEAD section of your HTML document.


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

3. From: Warren Taylor
11/15/2008 13:36:49

How do keep 3 onload functions from executing at once? I want to execute them sequentially...when one completes execution I want to begin execution of the next one?.

4. From: Lee (Admin)
11/18/2008 11:09:01

Well, that is what it does here. As each onload function listed in the script is encountered, it is executed. Then, it moves on to the next one.

1. From: rodger myles
Using the code
07/06/2007 15:54:39

addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
functionHere();
});
That bit at the end seems to imply to my inexperienced mind that I should enter something here.

Not quite sure what to do. Can you help?

2. From: Lee (Admin)
07/26/2007 15:46:56

Sure, you would want to enter the name of the function to load, e.g.,

Use this one:
addLoadEvent(yourFunction);

or this one:

addLoadEvent(function() {
yourFunctionHere();
});


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.