欢迎来到天天文库
浏览记录
ID:33521095
大小:79.50 KB
页数:18页
时间:2019-02-26
《javascript时间全解析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、javascript时间全解析(Date,setInterval,document)(一句废话下载0财富,要用先下载)废话少说,先上效果图:代码跟上:2、Content-Type"content="text/html;charset=utf-8"/>js日期格式化函数农历日期时间十分秒走动*{margin:0;padding:0;list-style-type:none;}a,img{
2、Content-Type"content="text/html;charset=utf-8"/>
3、border:0;}.time{height:32px;line-height:32px;overflow:hidden;font-size:14px;width:300px;margin:20pxauto;border:solid1px#ddd;padding:010px;background:#F7F7F7;}functioninitArray(){for(i=0;i4、++)this[i]=initArray.arguments[i];}varisnMonths=newinitArray("1","2","3","4","5","6","7","8","9","10","11","12");varisnDays=newinitArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");today=newDate();hrs=today.getHours();min=today.getMinutes();sec=toda5、y.getSeconds();clckh=""+((hrs>12)?hrs-12:hrs);clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;clck=(hrs>=12)?"下午":"上午";varstnr="";varns="0123456789";vara="";functiongetFullYear(d){yr=d.getYear();if(yr<1000)yr+=1900;returnyr;}6、"text/javascript">//下面各行分别是一种风格,把不需要的删掉即可document.write(""+getFullYear(today)+"年"+","+isnMonths[today.getMonth()]+"月"+today.getDate()+"日,"+isnDays[today.getDay()]+"
4、++)this[i]=initArray.arguments[i];}varisnMonths=newinitArray("1","2","3","4","5","6","7","8","9","10","11","12");varisnDays=newinitArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");today=newDate();hrs=today.getHours();min=today.getMinutes();sec=toda
5、y.getSeconds();clckh=""+((hrs>12)?hrs-12:hrs);clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;clck=(hrs>=12)?"下午":"上午";varstnr="";varns="0123456789";vara="";functiongetFullYear(d){yr=d.getYear();if(yr<1000)yr+=1900;returnyr;}6、"text/javascript">//下面各行分别是一种风格,把不需要的删掉即可document.write(""+getFullYear(today)+"年"+","+isnMonths[today.getMonth()]+"月"+today.getDate()+"日,"+isnDays[today.getDay()]+"
6、"text/javascript">//下面各行分别是一种风格,把不需要的删掉即可document.write(""+getFullYear(today)+"年"+","+isnMonths[today.getMonth()]+"月"+today.getDate()+"日,"+isnDays[today.getDay()]+"
7、nMonths[today.getMonth()]+"月"+today.getDate()+"日,"+isnDays[today.getDay()]+","+clck+""+clckh+":"+clckm+":"+clcks+"
8、cument.write(""+hrs+":"+clckm+":"+clcks+"
此文档下载收益归作者所有