一打开网页立即弹出一连串的日期提示,js获取系统日期并加以判断来实现这个效果,结合自己的需求来自定义修改。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <TITLE>打开网页立即弹出系统日期提示_武鸣人</TITLE> <META NAME="Generator" CONTENT="EditPlus"> </HEAD> <BODY> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <SCRIPT LANGUAGE="JavaScript"> <!-- Date.prototype.format = function (format){ if (format == null) format = "yyyy/MM/dd HH:mm:ss.SSS"; var year = this.getFullYear(); var month = this.getMonth(); var sMonth = ["January","February","March","April","May","June","July","August","September","October","November","December"][month]; var date = this.getDate(); var day = this.getDay(); var hr = this.getHours(); var min = this.getMinutes(); var sec = this.getSeconds(); var daysInYear = Math.ceil((this-new Date(year,0,0))/86400000); var weekInYear = Math.ceil((daysInYear+new Date(year,0,1).getDay())/7); var weekInMonth = Math.ceil((date+new Date(year,month,1).getDay())/7); return format.replace("yyyy",year).replace("yy",year.toString().substr(2)).replace("dd",(date<10?"0":"")+date).replace("HH",(hr<10?"0":"")+hr).replace("KK",(hr%12<10?"0":"")+hr%12).replace("kk",(hr>0&&hr<10?"0":"")+(((hr+23)%24)+1)).replace("hh",(hr>0&&hr<10||hr>12&&hr<22?"0":"")+(((hr+11)%12)+1)).replace("mm",(min<10?"0":"")+min).replace("ss",(sec<10?"0":"")+sec).replace("SSS",this%1000).replace("a",(hr<12?"AM":"PM")).replace("W",weekInMonth).replace("F",Math.ceil(date/7)).replace(/E/g,["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][day]).replace("D",daysInYear).replace("w",weekInYear).replace(/MMMM+/,sMonth).replace("MMM",sMonth.substring(0,3)).replace("MM",(month<9?"0":"")+(month+1)); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var d = new Date(); alert(d.format());//default format alert(d.format("MM-dd-yyyy")); alert(d.format("dd/MM/yy")); alert(d.format("dd\\MM\\yyyy HH:mm ss.SSS")); alert(d.format("yyyy年MM月dd日 HH时mm分ss.SSS秒")); alert(d.format("yyyy年MM月dd日 E HH(0~23)时mm分ss.SSS秒")); alert(d.format("yyyy年MM月dd日 E KK(0~11)时mm分ss.SSS秒 a")); alert(d.format("yyyy年MM月dd日 E hh(1~12)时mm分ss.SSS秒 a")); alert(d.format("yyyy年MM月dd日 E kk(1~24)时mm分ss.SSS秒 今年的第D天,第w周,MMMM这个月的第W周,MMM这个月的第F个E")); //--> </SCRIPT> </BODY> </HTML>
本文来自武鸣人网站,转载请注明出处