Home > front end >  About two script execution only one problem
About two script execution only one problem

Time:10-14

I will two scrip file into a JS, introduction, but can only perform a scrip second cannot execute, in front of the specific code is as follows:
/* first */
Var sWeek=new Array (" Sunday ", "Monday" and "Tuesday", "on Wednesday", "Thursday", "Friday", "Saturday");
Var dNow=new Date ();
Var CalendarData=https://bbs.csdn.net/topics/new Array (100);
Var madd=new Array (12);
Var tgString="xin armour YiBingDing e f g nonyl decyl";
Var dzString="ugly son Yin bases tatsumi noon not ShenYou xu-gou hai";
Var numString="ten";
Var monString="is the 23456789 believed la";
Var sx="rat ox tiger rabbit snake horses sheep monkey chicken dogs pigs".
Var cYear cMonth, cDay TheDate;
CalendarData=https://bbs.csdn.net/topics/new Array(0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A, 0xEA5, 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B, 0x25D, 0x92D, 0x2192B, 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6, 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54, 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B, 0x30D4A, 0xEA5, 0x80D65, 0x5AC, 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D, 0x92D, 0x5192B, 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95);
Madd [0]=0;
Madd [1]=31;
Madd [2]=59;
Madd [3]=90;
Madd [4]=120;
Madd [5]=151;
Madd [6]=181;
Madd [7]=212;
Madd [8]=243;
Madd [9]=273;
Madd [10]=304;
Madd [11]=334;

The function GetBit (m, n) {
Return (m & gt;> N) & amp; 1;
}

The function the e2c () {
TheDate=(the arguments length!=3)? New Date () : the new Date (the arguments [0], the arguments [1], the arguments [2]).
Var total, m, n, k;
Var isEnd=false;
Var TMP=TheDate. GetFullYear ();
Total=(TMP - 1921) * 365 + math.h floor ((TMP - 1921)/4) + madd [TheDate, getMonth ()] + TheDate, getDate () - 38;
If (TheDate getYear () % 4==0 & amp; & TheDate, getMonth () & gt; 1) {
Total++;
}
For (m=0;; M++) {
K=(CalendarData [m] <0 XFFF)? 11, 12;
For (n=k; N & gt;=0; N -) {
If (total & lt;=29 + GetBit (CalendarData [m], n)) {
IsEnd=true;
break;
}
Total=total - 29 - GetBit (CalendarData [m], n);
}
If (isEnd) break;
}
CYear=1921 + m;
CMonth=k - n + 1;
CDay=total;
If (k==12) {
If (cMonth==Math. Floor (CalendarData [m]/0 x10000) + 1) {
1 - cMonth cMonth=;
}
If (cMonth & gt; Math. Floor (CalendarData [m]/0 x10000) + 1) {
CMonth -;
}
}
}

/* lunar year of dog movement of 20 */
The function GetcDateString () {
Var TMP="";
TMP +=tgString. CharAt ((cYear - 4) % 10);
TMP +=dzString. CharAt (12) (cYear - 4) %;
TMP +=sx. CharAt (12) (cYear - 4) %;
TMP +="years";
If (cMonth & lt; 1) {
TMP +="(leap)";
TMP +=monString. CharAt (cMonth - 1);
} else {
TMP +=monString. CharAt (cMonth - 1);
}
TMP +="on";
TMP +=(cDay & lt; 11)? "Early" : ((cDay & lt; 20)? "Ten" : ((cDay & lt; 30)? "21" : "30"));
If (cDay % 10!=0 | | cDay==10) {
TMP +=numString. CharAt ((cDay - 1) % 10);
}
Return the TMP;
}

The function GetLunarDay (solarYear solarMonth, solarDay) {
If (solarYear & lt; 1921 | | solarYear & gt; 2020) {
return "";
} else {
SolarMonth=(parseInt (solarMonth) & gt; 0)? (solarMonth - 1) : 11;
The e2c (solarYear solarMonth, solarDay);
Return GetcDateString ();
}
}


The function getFullYear (d) {//correct firefox next year
Yr=d.g etYear ();
If (yr & lt; Yr + 1000)=1900;
Return yr;
}

/* write page */
The function showDate () {

Var D=new Date ();
Var yy=D.g etFullYear ();
Var mm=D.g etMonth () + 1;
Var dd=D.g etDate ();
Var ww=D.g etDay ();
Var ss=parseInt (D.g etTime ()/1000);
Var h=D.g etHours ();
Var m=D.g etMinutes ();
Var s=D.g etSeconds ();

Var (dNow) + sValue=https://bbs.csdn.net/topics/getFullYear "years" + (dNow, getMonth () + 1) + "month" + dNow. GetDate () + ", "+" "+ sWeek [dNow. GetDay ()] +" ";
SValue +=GetLunarDay (yy, mm, dd);
SValue +=shapetime (h, m, s);
Document. The getElementById (" pDate "). The innerHTML=sValue;
SetTimeout (" showDate () ", 500);
};
/* formatting time */
The function shapetime (h, m, s) {
If (s & lt;=9) s="0" + s;
If (m & lt;=9) m="0" + m;
If (h & lt;=9) h="0" + h;
Return the h + ":" + m + ":" + s
}
Window. The onl oad=showDate;
/* */
the secondVar index=0;

The function changeImg () {

//1. Get the picture that you want to switch element
Var img=document. GetElementById (" img1 ");
//calculate the current which image to switch to
Var curIndex=index % 4 + 2;//0,
CurIndex. Img SRC="https://bbs.csdn.net/topics/images/" + + ". PNG ";//1, 2, 3
//after each switch, index 1
index=index + 1;
}

The function the init () {

SetInterval (changeImg "()", 4000);
}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related