iLTC Home
Bookmark iLTC!
iLTC Google Boards

Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Use onLoad to Call More than One Function with Javascript

    Use onLoad to Call More than One Function with Javascript



    To call more than one function in onLoad with Javascript:

    <body onLoad="alert('First Hello!');alert('Second Hello!!')">

    -We enclose Javascript's built-in event handler onLoad in the body tag.
    -We call Javascript's built-in alert method twice, separated by a semicolon.
    -We enclose our text in single quotes because it's already inside double quotes.


    We could also call a script with onLoad that calls two functions:


    function coolAl() {
    firstHey();
    secondHey();
    }

    function firstHey() {
    alert("First Hello!");
    }

    function secondHey() {
    alert("Second Hello!");
    }

    <body onLoad="coolAl()">

    -We created a function and named it coolAl.
    ---Inside coolAl, we called our two other functions.
    -We created the two other functions and named them firstHey and secondHey.
    -We called our function coolAl in the onLoad event handler.



    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--

    function coolAl() {
    firstHey();
    secondHey();
    }

    function firstHey() {
    alert("First Hello!");
    }

    function secondHey() {
    alert("Second Hello!");
    }

    -->
    </script>

    <body onLoad="coolAl()">
    My home page


    Resources:
    Use onLoad in Body Tag with Javascript
    Opening an Alert Box in Javascript
    Call your Function in Javascript
    Create a Function in Javascript



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Use onLoad in Body Tag with Javascript
    Next Article: Get String Length with Javascript





    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.09

    Head First AjaxHead First Ajax

    Rebecca Riordan

    New $29.69

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $26.39

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09

    CSSCSS

    David McFarland

    New $23.09

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $29.69


    Of Interest:
  • Create or Put Items into an Array in Perl
  • Matching at the Beginning and End 2
  • Finding the Length (Index Numbers) of an Array in Perl
  • Use the Perl PRINT FUNCTION
  • Javascript Status Bar
  • Opening a REMOTE WINDOW in Javascript
  • Javascript Lowercase Text
  • Exit a For Loop in Javascript with Break
  • HTML Status
  • HTML Color Chart
  • HTML Superscript Text
  • Make Strikethrough Text Using HTML

  • More Articles:
  • Use the Perl PRINT FUNCTION
  • INCREMENT and DECREMENT a Variable in Perl
  • And, Or, Equal, Not Equal, Greater Than, Less Than in Perl
  • Matching at the Beginning and End 2
  • onClick Javascript
  • Increment a Variable in Javascript
  • Focus a Window with self.focus in Javascript
  • PRINT to Browser with document.write Command in Javascript
  • Formatting Time in Javascript
  • HTML Space
  • HTML Image
  • HTML Background
  • HTML Color Codes

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    581,191
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT