SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stupidly easy question on javascript

    Stupid question. what is the syntax for using a "or command in an if statement in javascript? I tried "||" but that didn't seem to do the trick. Any suggestions?

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured it out. I had () in the wrong places.

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (You're right, that WAS stupidly easy!!! )


    M@rco

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hope that helps a bit

    PHP Code:


    var a=true;
    var 
    b=false;

    if (
    a==true || b==truealert('either a or b are true');

    //=================================================

    var a=true;
    var 
    b=false;

    if (
    a!=true || b!=truealert('either a or b are false');

    //=================================================

    var a=true;
    var 
    b=true;

    if (
    a==true && b==truealert('a and b are true');

    //==================================================

    var a=true;
    var 
    b=true;

    if (
    a==true && b!=truealert('');

    //=================================================== 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •