var mymoney<=10,sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1;mymoney++)
{
sum= sum + mymoney;
}
document.write("sum合计:"+sum);
不能这么定义var mymoney<=10; 写成var mymoney ;
循环语句这样写
for(初始化变量;循环条件;循环迭代)
{
循环语句
}
var mymoney, sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1; mymoney<=10;mymoney++)
{
sum= sum + mymoney;
}
document.write("sum合计:"+sum);
var mymoney,sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1; mymoney<=10;mymoney++)
{
sum= sum + mymoney;
}
document.write("sum合计:"+sum);
应该就这样的吧