Simple calendar code

Source: Internet
Author: User
Tags getdate
Tip: you can modify some code before running

<!><table border="1" bordercolor="red"><colgroup><col /><col /><col /><col /><col /><col /><col /></colgroup><caption valign="top" id="cap" ></caption><tr ><td>Day</td><td>I</td><td>II</td><td>3.</td><td>Thu</td><td>V.</td><td>Sat.</td></tr><script language="javascript">Var objdate = new Date (); var tempdate = new Date (); tempdate. setDate (1); var day = tempdate. getDay (); var maxday = new Date (objdate. getYear (), objdate. getMonth () + 1, 0 ). getDate (); cap. innerText = objdate. getYear () + "year" + (objdate. getMonth () + 1) + "month" + objdate. getDate () + "day"; var d = 1, dd = 1; for (var I = 0; I <6; I ++) {document. write ("<tr>") For (var j = 1; j <8; j ++) {if (d <= day | dd> maxday) {document. write ("<td> </td>")}; Else if (dd = Number (objdate. getDate () {document. write ("<td bgcolor='silver'>"+ Dd +"</td>"); Dd ++} else {document. write ("<td>"+ Dd +"</td>"); Dd ++} d ++} document. write ("</tr>")}</script></table>
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

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.