0

WHY CAN'T THIS CODE WORK

var maths; //math section maths=(prompt("Enter Your Maths score")); if (maths=== "" ) alert("PLEASE FILL OUT BEFORE YOU SUBMIT THE FORM") (prompt("Enter Your Maths score")), else document.write("THANKS FOR YOUR TIME "+ "<br />" ); I WANT TO ALERT WHEN THE USER TRY TO SUBMIT AN EMPTY FORM, LIKE alert("PLEASE FILL OUT BEFORE YOU SUBMIT THE FORM") AND ALSO I WANT THE CODE TO TAKE USER BACK TO SUBMIT A FORM LIKE (prompt("Enter Your Maths Marks")), BUT IT DOESN'T WORK I DON'T KNOW WHY ACTUALLY

3rd Mar 2019, 7:39 PM
Glory222
Glory222 - avatar
3 Answers
+ 1
Cause of the lack of { } ; ? + You should use a do while boucle here Maths=""; Maths = prompt("fill out math score"); Do{ Maths=prompt("please fill out math score"); }while(Maths=="" || isNaN(Maths)); isNaN verify is not a number
3rd Mar 2019, 8:47 PM
Dyf Dyf
Dyf Dyf - avatar
+ 1
Curly braces are compulsory in Javascript. if(condition){ statement }else{ statement } Something like this
3rd Mar 2019, 9:18 PM
Ore
Ore - avatar
0
Try to check Maths length.
4th Mar 2019, 10:53 AM
M_N