if statements

Discussion in 'Javascript' started by Prophet, Nov 12, 2005.

  1. Prophet

    Prophet Guest

    I am new to webdesign and am looking for the correct way to do a "if"
    statement.

    Eg. if a>b then X, else Y

    I can do this in excel, but have never done this in a web page - I know this
    is so basic but it escapes me on how to do it.

    Thanks,
     
    Prophet, Nov 12, 2005
    #1
    1. Advertising

  2. Prophet

    McKirahan Guest

    "Prophet" <> wrote in message
    news:Vicdf.119105$yS6.38502@clgrps12...
    > I am new to webdesign and am looking for the correct way to do a "if"
    > statement.
    >
    > Eg. if a>b then X, else Y
    >
    > I can do this in excel, but have never done this in a web page - I know

    this
    > is so basic but it escapes me on how to do it.
    >
    > Thanks,


    Will this help?

    <html>
    <head>
    <title>test1234.htm</title>
    <script type="text/javascript">
    if (1 == 2) {
    alert("1 = 2");
    } else {
    alert("1 != 2");
    }
    (3 == 4) ? alert("3 = 4") : alert("3 != 4");
    </script>
    </head>
    <body>
    </body>
    </html>
     
    McKirahan, Nov 12, 2005
    #2
    1. Advertising

  3. Prophet

    Lee Guest

    Prophet said:
    >
    >I am new to webdesign and am looking for the correct way to do a "if"
    >statement.
    >
    >Eg. if a>b then X, else Y
    >
    >I can do this in excel, but have never done this in a web page - I know this
    >is so basic but it escapes me on how to do it.


    The correct way to do it is to find a manual or on-line tutorial.
    You don't guess, and you don't ask for help with something that basic.

    Hope this helps.
     
    Lee, Nov 12, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rajan

    generate statements

    rajan, Jul 3, 2003, in forum: VHDL
    Replies:
    1
    Views:
    8,482
    Egbert Molenkamp
    Jul 4, 2003
  2. Neil Zanella
    Replies:
    8
    Views:
    1,193
    mfmehdi
    Oct 20, 2006
  3. Harry George
    Replies:
    6
    Views:
    378
    Bart Nessux
    Feb 23, 2004
  4. Vince
    Replies:
    12
    Views:
    750
    Martin Gregorie
    Jan 21, 2008
  5. John Crichton
    Replies:
    6
    Views:
    265
    John Crichton
    Jul 12, 2010
Loading...

Share This Page