Compatible with ie6 ie7 and ie8 firefox js date display code (firefox shows 110 years)

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

<!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">Function showdate () {var d = new date (); // var year = new date (). getfullyear (); document. write (year); document. write ("<div class="date_div">"+ D. getfullyear () + "year" + (d. getmonth () + 1) + "month" + d. getdate () + "day"); switch (d. getday () {case 0: document. write ("Sunday"); break; case 1: document. write ("Monday"); break; case 2: document. write ("Tuesday"); break; case 3: document. write ("Wednesday"); break; case 4: document. write ("Thursday"); break; case 5: document. write ("Friday"); break; case 6: document. write ("Saturday"); break;} document. write ("111cn.net</div>");}</script></head><body><script language="javascript">Showdate ();</script><!-- 说明:在ie中得到的日期是"2010",在firefox中看到的日期是"110",主要是因为在 firefox 里面 getyear 返回的是 "当前年份-1900" 的值。【兼容处理】加上对年份的判断,如:var year= new date().getyear();year = (year<1900?(1900+year):year);document.write(year);  也可以通过 getfullyear getutcfullyear 去调用:var year = new date().getfullyear();document.write(year);--></body></html>
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: info-contact@alibabacloud.com 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.