<html>
<head>
<title>The NaN property of the Number object</title>
<script type="text/javascript" language="javascript">
<!-- //
function Calculate(){
var entry;
var number = new Number();
entry = prompt("Enter a number or string: ", "Enter number or string here");
number = Number(entry);
if (isNaN(number)){
document.writeln("<P>You entered: " + entry+ "</p>");
document.write("<P>It was not a number</p>");}
else{
document.writeln("<P>You entered: " + entry + "</p>");
document.write("<P>It was a number.</p>");
}
}
// -->
</script>
</head>
<body onload="Calculate()">
</body>
</html>
|