Results 1 to 4 of 4

Thread: if/then

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    USA
    Posts
    95

    if/then

    Where can I learn more about the if/then statement in this format:
    var x = "hello";
    x=(x=="hello")? alert("hello") : alert("bye")
    thank you

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Well, it shouldn't have the x= on the front.

    I just have an ORielly book around. I don' t know of any online JavaScript references, but I'm sure there are some.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3

  4. #4
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    Its the TERNARY OPERATOR.

    http://msdn.microsoft.com/library/de...onditional.asp

    This link gives a sample of its usage and other operators too...

    - Jemima.

Posting Permissions

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



Click Here to Expand Forum to Full Width