ch03_q4.htm
来自「javascript source code part1」· HTM 代码 · 共 35 行
HTM
35 行
<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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?