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
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
+ 1
Curly braces are compulsory in Javascript.
if(condition){
statement
}else{
statement
}
Something like this
0
Try to check Maths length.