Start time & lt;/td> | | End time & lt;/td> | | |
var now;//the current date
Var allDay=new Array (42);//date array
Var n;//number on the first day of the month week
Var days;//number of days during the month
/* *
* get the current date
*/
The function getCurrentDate () {
Var time=document. GetElementById (" start "). The value;
Now=new Date (time substr (0, 10));
}
/* *
* the main function
*/
The function main (STR) {
Var source=STR;
GetCurrentDate ();
Var strFrame='& lt; The table class=mt id=mt> ';
StrFrame +='& lt; tr> ';
StrFrame +='& lt; td> ';
StrFrame +="& lt; Id=p \ "prevM " onclick=\ "prevMonth () " & gt; ";
StrFrame +='& lt; <';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; Td colspan=5 & gt; ';
StrFrame +='& lt; P> ';
StrFrame +=now. GetFullYear () + 'years' + (now, getMonth () + 1) +' month ';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +="& lt; Id=p \ "nextM " onclick=\ "nextMonth () " & gt; ";
StrFrame +='& gt;> ';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt;/tr> ';
StrFrame +='& lt; tr> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +=', ';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='a';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='2';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='three';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='4';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='five';
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt; td> ';
StrFrame +='& lt; P> ';
StrFrame +='6'.
StrFrame +='& lt;/p> ';
StrFrame +='& lt;/td> ';
StrFrame +='& lt;/tr> ';
StrFrame +='& lt;/table> ';
Var div1=document. GetElementById (" div1 ");
Var div2=document. GetElementById (" div2 ");
If (source=='end') {
Alert (" true ");
Div2. InnerHTML=strFrame;
Div1. InnerHTML="";
} else {
Alert (" false ");
Div1. InnerHTML=strFrame;
Div2. InnerHTML="";
}
Document. The getElementById (" prevM "). The addEventListener (" click ", prevMonth);
Document. The getElementById (" nextM "). The addEventListener (" click ", prevMonth);
}
The function prevMonth () {
Alert (" a ");
}
The function nextMonth () {
Alert (" b ");
}
After the operation only can perform the onclick in div2, cannot perform div1, what reason be? Which master know?