CSC 230: The Week beginning Jan. 27 |
Provide a brief definition of the following terms (in the interface programming context):
var num1 = document.getElementById("txtNum").value;Thus we also have to test whether num1 is blank. The || is an OR -- if either condition is true then the code inside the if will be executed
if (isNaN(num1) || num1=="") { alert("That's not a number"); //yell at user return; //get out of here }
oninput
event for the input. Added a page load since Firefox was not clearing everything
out the way we wanted when the page was refreshed.