我不知道为什么代码不能重复问问题......然后我把它放在那里......没有任何功能......
<script type='text/javascript'>
var done;
do{
var num = prompt("Enter Number", "0") //prompt user to enter the number
number = parseInt(num); //parse the num to number
var i;
document.write('<table border="1" cellspacing="0">');
for(i=1;i<=12;i++)
{
document.write("<tr><td>" + i + " x " + number + " = " + number*i + "</td></tr>");
}
document.write("</table>");
}while(window.confirm("Do you want to enter another number to show another multiplication table?")
</script>
答案 0 :(得分:0)
你在} while ... line
上缺少一个括号结尾<script type='text/javascript'>
var done;
do{
var num = prompt("Enter Number", "0") //prompt user to enter the number
number = parseInt(num); //parse the num to number
var i;
document.write('<table border="1" cellspacing="0">');
for(i=1;i<=12;i++)
{
document.write("<tr><td>" + i + " x " + number + " = " + number*i + "</td></tr>");
}
document.write("</table>");
}while(window.confirm("Do you want to enter another number to show another multiplication table?"))
答案 1 :(得分:0)
我认为您忘记了')'符号来关闭while
while(
window.confirm(
"Do you want to enter another number to show another multiplication table?"
)
) // <- This one