ie上运行为什么没有效果
为什么在ie上看不到平均成绩?而显示的是undefined
我的代码是这样的:
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全带,准备启航</title>
<script type="text/javascript">
var Udate=new Date()
var week= ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
document.write(Udate.getFullYear()+"年"+(Udate.getMonth()+1)+"月"+Udate.getDate()+"日 "+week[Udate.getDay()]+"--"+"班级总分为:"+age+"<br />");
var scoreStr ="小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var name1=scoreStr.split(";");
var sum=0
for (var i=0;i<name1.length;i++){
sum = sum + parseInt(name1[i].substr(name1.indexOf(":")+1));
}
var age=sum/name1.length;
</script>
</head>
<body>
</body>
</html>