<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns ="http://www.w3.org/1999/xhtml" > <head > <meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" / > <title >无标题文档</title > <script language ="javascript" > var time=new Date(); var rz=time.getDate();//22 document.write("日 一 二 三 四 五 六 <br/>"); var today=time.getDay(); var month=time.getMonth();//得到当前月 2 time.setDate(1); var xqq=time.getDay(); for(i=0;i<xqq;i++){ document.write(" "); } var tmp=1; time.setDate(tmp); while(time.getMonth()==month){ var cd=time.getDate(); if(cd<10){ document.write("0"); } if(cd==rz){ document.write("<font color='red'>"+cd+"</font> "); } else{ document.write(cd+" "); } //星期六换行 if(time.getDay()==6){ document.write("<br/>"); } tmp++; time.setDate(tmp); } </script > </head > <body > </body > </html >
JS写日历
最新推荐文章于 2024-05-07 23:43:18 发布