?
Solved

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

Posted on 2012-03-18
4
Medium Priority
?
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 1000 total points
ID: 37736019
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 1000 total points
ID: 37736081
@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
ID: 37736117
Thanks leakim971 for correcting my samples.
0
 
LVL 10

Expert Comment

by:d4durvesh
ID: 37739058
use jquery to do that...
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

800 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