关于万年历运行后CPU不占用的代码:
只要对内核中的: var now,y0,m0,d0,h0,min0,sec0,ha,mina,seca,sN1,sN2,sDate1,sDate2,flag,i1,i2,nowpoint;
var dateNum=new Array(),lunMonth=new Array(),lunNum=new Array();
function ini(){
now=new Date;
y0=now.getYear();
if(y0<2000)
y0+=1900;
m0=now.getMonth()+1;
d0=now.getDate();
h0=now.getHours();
min0=now.getMinutes();
if(min0<10)
min0='0'+min0;
sec0=now.getSeconds();
if(sec0<10)
sec0='0'+sec0;
timer1=setTimeout("ini()",500);
}ini();
改为:
function Login(){
clearTimeout(timer1);
clearTimeout(timer2);
setTimeout("Login()",600)
}
var now,y0,m0,d0,h0,min0,sec0,ha,mina,seca,sN1,sN2,sDate1,sDate2,flag,i1,i2,nowpoint;
var dateNum=new Array(),lunMonth=new Array(),lunNum=new Array();
function ini(){
now=new Date;
y0=now.getYear();
if(y0<2000)
y0+=1900;
m0=now.getMonth()+1;
d0=now.getDate();
h0=now.getHours();
min0=now.getMinutes();
if(min0<10)
min0='0'+min0;
sec0=now.getSeconds();
if(sec0<10)
sec0='0'+sec0;
timer1=setTimeout("ini()",500);
setTimeout("Login()",600)
}ini();
这样改后运行万年历CPU占用就只有1%不到