basic-javascript-appendix-3-ch03-q4.htm / htm
<HTML> <BODY> <SCRIPT LANGUAGE=JavaScript> function writeTimesTable(timesTable, timesByStart, timesByEnd) { for (;timesByStart <= timesByEnd; timesByStart++) { document.write(timesTable + " * " + timesByStart + " = " + timesByStart * timesTable + "<BR>"); } } var timesTable; while ( (timesTable = prompt("Enter the times table",-1)) != -1) { while (isNaN(timesTable) == true) { timesTable = prompt(timesTable + " is not a valid number, please retry",-1); } if (timesTable == -1) { break; } document.write("<BR>The " + timesTable + " times table<BR>"); writeTimesTable(timesTable,1,12); } </SCRIPT> </BODY> </HTML>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.