iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I love the code... dot com
    143,010

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > If, Else If, and Else in Javascript

    If, Else If, and Else in Javascript



    var gygy="London";

    if (gygy == "Paris") {
    document.write("The city is Paris");
    }
    else if (gygy == "Tokyo") {
    document.write("The city is Tokyo");
    }
    else {
    document.write("The city is London.");
    }


    In plain English:
    -The variable we named gygy equals London.
    -We say: If gygy equals Paris, print one thing.
    -We then say: Else If gygy equals Tokyo, print a different thing.
    -We then say: or Else! If all else fails, print this other thing.


    Copy and Paste Javascript Code:

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

    var gygy="London";

    if (gygy == "Paris") {
    document.write("The city is Paris. ");
    }
    else if (gygy == "Tokyo") {
    document.write("The city is Tokyo. ");
    }
    else {
    document.write("The city is London. ");
    }


    if (gygy == 1) {
    document.write("One");
    }
    else if (gygy == 2) {
    document.write("Two");
    }
    else {
    document.write("Three");
    }

    -->
    </script>



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Match with a Regular Expression, REGEX, in Javascript
    Next Article: Environmental Variables Available in Javascript using Navigator Object





    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

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

    Louis Rosenfeld, P...

    New $26.39

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    HTML & XHTMLHTML & XHTML

    Chuck Musciano, Bi...

    New $29.99

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

    Elizabeth Castro

    New $23.09

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    New Perspectives on Crea...New Perspectives on Creating Web Pag...

    Patrick Carey

    New $69.26


    Of Interest:
  • To Sort an Array in Perl
  • What Environmental Variables are Available
  • Use chmod in Perl
  • OPEN and WRITE a Data File in Perl
  • Javascript Superscript Text
  • Javascript Splice - Use Splice to Replace Items in an Array in Javascript
  • Make Text Blink Using Javascript
  • Environmental Variables Available in Javascript using Navigator Object
  • HTML Title Tag
  • Make a Line Return Using HTML
  • HTML Tables
  • HTML Frames

  • More Articles:
  • Matching at the Beginning and End
  • Making a Directory Using mkdir in Perl
  • Exit a Loop with Last
  • INCREMENT and DECREMENT a Variable in Perl
  • onClick Javascript
  • Substitute in Javascript Using replace Method
  • Exit a For Loop in Javascript with Break
  • Focus a Window with self.focus in Javascript
  • Make a New Paragraph Using HTML
  • HTML Background
  • HTML Title Tag
  • 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


    439,775
    Counter by iLoveTheCode.com


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