Yes I am an ordinary student who sucks at coding and leaves assessments to the last minute. Help me out guys!
I'm want to add IF statements on each variable. For example, if the user did not enter a answer or the answer is null, I want a message to say "not supplied" instead of null onto the webpage (document.writeln), not as an alert on prompt box.
Im guessing the code is something like.... if(firstname = null) document.writeln("First name not supplied")?????
var firstname;
var lastname;
var height;
firstname = prompt("Please enter first name of player 1", "");
document.writeln("<td>" + firstname + "</td>");
lastname = prompt("Please enter last name of player 1", "");
document.writeln("<td>" + lastname + "</td>");
height= prompt("Please enter height of player 1 in metres", "");
document.writeln("<td>" + height + "</td>");
</script>
</tr>
</body>
Aucun commentaire:
Enregistrer un commentaire