I am trying to use a javascript function to change the action of a html form based on several if else statements and it's throwing up some strange results which are clearly to do with bad syntax but I am at a rut trying to figure it out! For testing purposes I have made the function simply show a notification on the page rather than amend the form action so it will just state either kept or sent depending on the if else result. Here is the if statement if (b/p>0.85) {document.getElementById('notification').innerHTML ="sent";} else if (ccj!="NO"||iva!="NO"||bkcy!="NO"&&(ltv>0.75)) {document.getElementById('notification').innerHTML ="sent";} else if (b<100000) {document.getElementById('notification').innerHTML ="sent";} else if (dob<1940) {document.getElementById('notification').innerHTML ="sent";} else if (dob<1940) {document.getElementById('notification').innerHTML ="sent";} else if (bkcy=='less_1yr'||bkcy=='years1_2') {document.getElementById('notification').innerHTML ="sent";} else if (occ=='UNEMPLOYED') {document.getElementById('notification').innerHTML ="sent";} else {document.getElementById('notification').innerHTML ="kept";} I am trying to get all enquiries over 85% to send, or if they have a CCJ, IVA or Bankruptcy send if its over 75% and its only this part of the statement that won't work. Any help much appreciated! Thanks
From what I understand, the 2nd line of that code is screwing up and that the conditional statement in this line needs 2 things to be true--either ccj, iva or bkcy does not equal "NO" and ltv>.75 else if ((ccj!="NO"||iva!="NO"||bkcy!="NO") &&(ltv>0.75)) {document.getElementById('notification').innerHTML ="sent";} PHP: Putting parenthesis around the first 3 elements will make sure your 2 conditions are evaluated properly. Also, and not related to your problem, your 3rd and 4th lines are redundant: else if (dob<1940) {document.getElementById('notification').innerHTML ="sent";} PHP: