Solved

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

Posted on 2012-03-18
4
214 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 250 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 250 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

730 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