<!DOCTYPE HTML> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>系好安全带,准备启航</title> <script type="text/javascript"> var mystr=new Date(); var a=mystr.getFullYear(); var b=mystr.getMonth(); var c=mystr.getDate()
前面日期对的,但后面没结果。
var scoreStr=new Array();
var scoreStr="小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var str1=scoreStr.split(";");
var str2=str1.split(":");
var sum=0;
for(var i=0;i<=(str2.length);i=i+2){
str2[i+1]=parseInt(str2.substring(i+1,i+2));
sum=str2[i+1]+sum;
}
document.write(sum);