<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>系好安全带,准备启航</title>
<script type="text/javascript">
var date=new Date() ;
var year=date.getFullYear();
var month=date.getMonth()+1;
var day=date.getDate();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var week=date.getDay();
document.write(year+"年"+month+"月"+day+"日"+" "+weekday[week])
var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var score1=new Array();
score1=scoreStr.split(';');
var sum=0;
for(var i=0;i<score1.length;i++){
var score2=new Array();
score2=score1[i].split(':');
sum+=parseInt(score2[i]);
}
document.write("<br><br>总分数:"+sum);
document.write("<br><br>平均分:"+Math.round(sum/(score1.length)));
</script>
</head>
<body>
</body>
</html>
你的逻辑写的有问题..在你的循环里面,循环了两次分割字符串,每次的第一个都是汉字,导致得到的i结果有汉字和数字的结合...肯定是得不到任何值的...建议你修改下逻辑,如果有问题可以继续问