www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help with 'else if' and 'or' statement and operator

  1. #1
    Join Date
    Dec 2012
    Posts
    1

    Help with 'else if' and 'or' statement and operator

    I'm working on a project and I want to use the following function to check if the user has filled out the needed steps:

    Code:
    function stepCheck() {
    if (!(document.OnlineForm.cardoption[0].checked == true || document.OnlineForm.cardoption[1].checked == true))
    alert("Please Select A Payment Option Under Billing Info.");
    }else if(!(document.OnlineForm.shipping[0].checked == true || document.OnlineForm.shipping[1].checked == true || OnlineForm.shipping[2].checked == true)){
    alert("Please Select A Shipping Option.");
    }else if(!(document.OnlineForum.tou.value == true)){
    alert("Please Accept The Terms of Use.");
    }
    When I load it, I get a 'Syntax Error' message on the first 'else if' statement

    all help is appreciated, thanks
    AhellHound

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    you were missing those curly braces
    Code:
    function stepCheck() {
        if (!(document.OnlineForm.cardoption[0].checked == true || document.OnlineForm.cardoption[1].checked == true)){
    		alert("Please Select A Payment Option Under Billing Info.");
    		}
    	else if (!(document.OnlineForm.shipping[0].checked == true || document.OnlineForm.shipping[1].checked == true || OnlineForm.shipping[2].checked == true)) {
    		alert("Please Select A Shipping Option.");
    		}
    	else if (!(document.OnlineForum.tou.value == true)) {
    		alert("Please Accept The Terms of Use.");
    		}
    }

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



Recent Articles