Solved

Need two functions to run on window.onload.  How do I that?

Posted on 2012-03-18
4
210 Views
Last Modified: 2012-03-20
Hello,

I need two functions to run on window.onload.  Currently, only the first one listed runs.  How do I get the second one to run?

window.onload = getState;  SelectSchoolType;
0
Comment
Question by:NewWebDesigner
  • 2
4 Comments
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 250 total points
Comment Utility
Two different ways to try:

window.onload = function() {
  getState;
  SelectSchoolType;
}

Or create a nother function called say DoTwo like:

function DoTwo {
getState;
SelectSchoolType;
}

window.onload = DoTwo ;

Then do
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
Comment Utility
@giltjr, you miss parentheses, it should be :

window.onload = function() { 
  getState();
  SelectSchoolType();
}

Open in new window

or :
window.onload = DoTwo ;

function DoTwo() {
getState();
SelectSchoolType();
}

Open in new window

0
 
LVL 57

Expert Comment

by:giltjr
Comment Utility
Thanks leakim971 for correcting my samples.
0
 
LVL 10

Expert Comment

by:d4durvesh
Comment Utility
use jquery to do that...
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now