输出不了?
var mydate=new Date();
var dateToday=mydate.getFullYear()+"年"+mydate.getMonth()+'月'+mydate.getDate()+'日';
var myweekday=new Date();
var weekday=['Sunday','Monday','Tuesday','Weekday','Thursday','Friday','Saturday'];
document.write(dateToday.concat(weekday[myweekday.getDay()])+"<br/>");
var scoreStr ="小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var everyscore=scoreStr.split(';'); //此时every是一个数组。
// document.write(everyscore+"<br/>");
var sum=0;
for(i=0;i<=everyscore.length;i++){
var index=everyscore[i].indexOf(':')
var everynum=parseInt(everyscore[i].substr(index+1,2) );
// document.write(everynum+' ');
sum=sum+everynum;
}
document.write(sum);
还有,为什么参代里会给平均数赋值0,直接var av =sum/everyscore.length;不可以吗?