<script style="text/javascript"> // Copyright by http://scriptdemo.blogspot.com function ComputeArray(n) { var BH=new Array(); BH=["..----.",".|....|.", "..----.",".|....|.","..----."]; var patt=/\./g; switch (n) { case 0: BH[2]=BH[1]; break; case 1: BH[0]=BH[2]=BH[4]="......."; BH[1]=BH[3]=BH[1].replace(/\|/,"\."); BH[2]=BH[1]; break; case 2: BH[1]=BH[1].replace(/\|/,"\."); BH[3]=BH[3].replace(/\.\.\|/,"\.\.\."); break; case 3: BH[1]=BH[3]=BH[1].replace(/\|/,"\."); break; case 4: BH[0]=BH[4]="......."; BH[3]=BH[3].replace(/\|/,"\."); break; case 5: BH[1]=BH[1].replace(/\.\.\|/,"\.\.\."); BH[3]=BH[3].replace(/\|/,"\."); break; case 6: BH[1]=BH[1].replace(/\.\.\|/,"\.\.\."); break; case 7: BH[1]=BH[3]=BH[1].replace(/\|/,"\."); BH[2]=BH[1]; BH[4]="......."; break; case 9: BH[3]=BH[3].replace(/\|/,"\."); break; default: // for eight } return BH; } function ShowCal() { var yymmdd=new Date(); BH =new Array(); yy=yymmdd.getFullYear(); numstr=yy+''; for (var nj=0; nj<numstr.length; nj++) { BH[nj]=ComputeArray(parseInt(numstr.substr(nj,1))); } BH[4]=["........","","","",""] mm=yymmdd.getMonth()+1; numstr=mm+''; if (numstr.length==1) { numstr="0"+numstr; } for (var nj=0; nj<numstr.length; nj++) { BH[nj+5]=ComputeArray(parseInt(numstr.substr(nj,1))); } BH[7]=[".....","","","",""]; dd=yymmdd.getDate(); numstr=dd+''; if (numstr.length==1) { numstr="0"+numstr; } for (var nj=0; nj<numstr.length; nj++) { BH[nj+8]=ComputeArray(parseInt(numstr.substr(nj,1))); } document.write("<table>"); for (var nj=0; nj<BH.length; nj++) { document.write("<td>"); for (var ni=0; ni<=4; ni++) { document.write("<b>"+BH[nj][ni].replace(/\./g," ")+"</b><br>"); } document.write("</td>") } document.write('</table>') } ShowCal(); </script> |
Wednesday, March 31, 2010
Show Calendar
Labels:
Calendar,
javascript,
script,
脚本
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment