Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onload = startup;
- var coffee;
- var output;
- function startup() {
- var submit = document.getElementById("formSubmit");
- submit.addEventListener("click", checkNumber);
- }
- function checkNumber() {
- coffee = parseInt(document.getElementById("formAmount").value);
- output = document.getElementById("formResult");
- if(coffee <= 3){
- output.innerHTML = "You definitely need more coffee! How are you awake?";
- }
- else{
- output.innerHTML = "You need more coffee! You need at least " +(coffee + 1)+ " cups in total";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement