大神们帮我看下为什么输出全班成绩时只有一个元素呢?
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全带,准备启航</title>
<script type="text/javascript">
//通过javascript的日期对象来得到当前的日期,并输出。
var mydate=new Date();
document.write(mydate.getFullYear()+"年"+(mydate.getMonth()+1)+"月"+mydate.getDay()+"日"+"<br/>");
var myweek=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]
var mynum=mydate.getDay();
document.write(myweek[mynum]+"<br/>");
//成绩是一长窜的字符串不好处理,找规律后分割放到数组里更好操作哦
var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var myarray=scoreStr.split(";");
var myarr=new Array();
document.write(myarray+"<br/>");
for(var i=0;i<myarray.length;i++){
myarr=myarray[i].slice(3);
}
document.write(myarr+"<br/>");
var sum = 0;
for(var j=0;j<myarr.length;j++){
sum = sum +parseInt(myarr[j]);
}
var pingjun=sum/myarr.length;
var pj=Math.round(pingjun);
document.write("全班平均成绩:"+pj+"<br/>")
</script>
</head>
<body>
</body>
</html>