4.19 javascript寫一個日曆(用表格寫)

來源:互聯網
上載者:User

    <title>日曆</title> 
</head>
<body >

   <SCRIPT language=JavaScript>
function Year_Month(){
    var now = new Date();
    var yy = now.getYear();
    var mm = now.getMonth()+1;
    var cl = '<font color="#0000df">';
    if (now.getDay() == 0) cl = '<font color="#c00000">';
    if (now.getDay() == 6) cl = '<font color="#00c000">';
    return(cl +  yy + '年' + mm + '月</font>'); }
 function Date_of_Today(){
    var now = new Date();
    var cl = '<font color="#ff0000">';
    if (now.getDay() == 0) cl = '<font color="#c00000">';
    if (now.getDay() == 6) cl = '<font color="#00c000">';
    return(cl +  now.getDate() + '</font>');
     }
   
 function Day_of_Today(){
    var day = new Array();
    day[0] = "星期日";
    day[1] = "星期一";
    day[2] = "星期二";
    day[3] = "星期三";
    day[4] = "星期四";
    day[5] = "星期五";
    day[6] = "星期六";
    var now = new Date();
    var cl = '<font color="#0000df">';
    if (now.getDay() == 0) cl = '<font color="#c00000">';
    if (now.getDay() == 6) cl = '<font color="#00c000">';
    return(cl +  day[now.getDay()] + '</font>'); }
 function CurentTime(){
    var now = new Date();
    var hh = now.getHours();
    var mm = now.getMinutes();
    var ss = now.getTime() % 60000;
    ss = (ss - (ss % 1000)) / 1000;
    var clock = hh+':';
    if (mm < 10) clock += '0';
    clock += mm+':';
    if (ss < 10) clock += '0';
    clock += ss;
    return(clock); }
function refreshCalendarClock(){
document.all.calendarClock1.innerHTML = Year_Month();
document.all.calendarClock2.innerHTML = Date_of_Today();
document.all.calendarClock3.innerHTML = Day_of_Today();
document.all.calendarClock4.innerHTML = CurentTime(); }

var webUrl=webUrl;

//////////////////////////////////////////////////
//寫個表格

document.write('<table border="1" cellpadding="0" cellspacing="0" width="61" bgcolor="#c0c0c0">');
document.write('<tr><td>');
document.write('<font id="calendarClock1" style="font-family:宋體;font-size:7pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock2" style="color:#ff0000;font-family:Arial;font-size:14pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock3" style="font-family:宋體;font-size:9pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock4" style="color:#100080;font-family:宋體;font-size:8pt;line height:120%"><b> </b></font>');
//document.write('<font id="calendarClock4" style="color:#100080; font-family:宋體; font-size:8pt; line-height:120%<b></b><font>');
document.write('</td></tr></table>');

setInterval('refreshCalendarClock()',1000);
</SCRIPT>

     </div>
   
</body>
</html>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.