慕粉3936910
2016-12-28 13:42
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>if...else</title>
<script type="text/JavaScript">
var mymoney,sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1;mymoney<=10;mymoney++);
{
sum= sum + mymoney;
}
document.write("sum合计:"+sum);
</script>
</head>
<body>
</body>
</html>
for(mymoney=1;mymoney<=10;mymoney++);
{
sum= sum + mymoney;
}
把for语句后面的分号去掉试试
多个”;“,根本没有循环
JavaScript进阶篇
468276 学习 · 21892 问题
相似问题