Write a javascript that asks the user to input a number chec
Write a javascript that asks the user to input a number, check for the item to be numberic and repeat the question if it is not.
Solution
<html>
 <head> </head>
 <body onload=\"promptForNumber();\">
<script>
 function promptForNumber( text)
 {
 if(text == \'\' ){
 text = \"Please enter a number\";   
 }
 var number = parseInt(window.prompt(text, \"\"));
 checkNumber(number);
}
 function checkNumber(number){
if (isNaN(number)) {
 promptForNumber(\"It is not a number. Please enter a number \", \"\");
 }
}
</script>
</body>
 </html>

