Results 1 to 5 of 5

Thread: I have a problem with multiple IF statements.

  1. #1
    Join Date
    Oct 2003

    I have a problem with multiple IF statements.


    I have coded a new window to open when a total of values that I have allocated to radio buttons is submitted.
    I'm self taught so am not sure of the formatting although have spent weeks trying to solve it.
    When the values are SUBMITTED the windows will either only open after total > 50 in the first example or works for all values except for between 41 & 50 in the second example.
    See txt file for details.
    Thanks to anyone who can help.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2003
    Ok this may or maynot help:

    In the score() function, where you have 2 numbers one of them is >= and the other is <= try putting the javascript and symbol (&&) inbetween them so it looks like this:

    function score() {
    if (total <= 20)(undertwo());
    if (total >= 21 && <= 30)(overtwo());
    if (total >= 31 && <= 40)(overthree());
    if (total >= 41 && <= 50)(overfour());
    if (total >= 51 && <= 60)(overfive());
    if (total >= 61)(oversix())

    Hope this helps.

  3. #3
    Join Date
    Oct 2003

    Multiple IF statements.

    Unfortunately the && just brings up a syntax error.
    Thanks for trying though.

  4. #4
    Join Date
    Aug 2003
    I think this will correct the problem.

    When using an AND && or OR || each side of the expression is calculated independently.

    So this code:

    (total >= 21 && <= 30)

    Should read:

    (total >= 21 && total <= 30)

  5. #5
    Join Date
    Oct 2003

    Thumbs up Multiple IF statements.

    After weeks over tearing my hair out and scanning all the books I have at last, thanks to you it works.
    Your a star.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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