當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
软件开发javascript html实现网页版日历代码_javascript技巧
生活随笔
收集整理的這篇文章主要介紹了
软件开发javascript html实现网页版日历代码_javascript技巧
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
軟件開發javascript html實現網頁版日歷代碼_javascript技巧本文實例為大家分享了網頁版日歷代碼,供大家參考,具體內容如下
效果圖:
實現代碼:
<span style="color:#555555"><span style="background-color:#ffffff"><span style="background-color:#ededed"> </span></span></span> <script language="javascript"> var my = new Date(); function showc() { var k=1; var j=1; var today; var tomonth; var theday=1;//日期 var max; var temp; var tempday;//這個月第一天的星期 document.write ("" + my.getFullYear() + "-" + (my.getMonth()+1) + ""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); document.write (""); temp=my.getDate(); my.setDate(1); //document.write (my.getDate()); tempday=my.getDay();//返回第一天是星期幾 my.setDate(temp); today=my.getDay();//返回現在星期幾 switch ((my.getMonth()+1)) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: max=31; break; case 4: case 6:case 9: case 11: max=30; break; default: max=29;//這里沒有考慮閏月!! //document.write (max); } for(k=0;k<6;k++) { document.write (""); for(j=0;j<=6;j++) { document.write (""); } document.write (""); }document.write ("| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
| "); if(j>=(tempday)) { tempday=0;//設置為最小,相當于取消判斷條件 if(theday<=max) { document.write (""); if(theday==my.getDate()) document.write ("[" + theday + "]"); else if(j==0) document.write ("" + theday + ""); else document.write (theday + ""); theday++; } } document.write (" |
以上就是本文的全部內容,希望大家可以輕松實現網頁版日歷。
總結
以上是生活随笔為你收集整理的软件开发javascript html实现网页版日历代码_javascript技巧的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 24X24 黑体简体中文点阵字库
- 下一篇: 中职学校计算机专业课程设置,中职学校计算