[AS3]js兼容火狐和ie的精确到分秒时间
[AS3]js兼容火狐和ie的精确到分秒时间
[AS3]js兼容火狐和ie的精确到分秒时间
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>无标题文档</title>
- <script language="javascript" type="text/javascript">
- function tick() {
- var hours, minutes, seconds, xfile;
- var intHours, intMinutes, intSeconds;
- var today, theday;
- today = new Date();
- // function initArray() {
- // this.length = initArray.arguments.length
- // for (var i = 0; i < this.length; i++)
- // this[i + 1] = initArray.arguments[i]
- // }
- var d = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
- theday = today.getFullYear() + "年" + [today.getMonth() + 1] + "月" + today.getDate() + " " + d[today.getDay() + 1];
- intHours = today.getHours();
- intMinutes = today.getMinutes();
- intSeconds = today.getSeconds();
- if (intHours == 0) {
- hours = "12:";
- xfile = "午夜";
- } else if (intHours < 12) {
- hours = intHours + ":";
- xfile = "上午";
- } else if (intHours == 12) {
- hours = "12:";
- xfile = "正午";
- } else {
- intHoursintHours = intHours - 12
- hours = intHours + ":";
- xfile = "下午";
- }
- if (intMinutes < 10) {
- minutes = "0" + intMinutes + ":";
- } else {
- minutes = intMinutes + ":";
- }
- if (intSeconds < 10) {
- seconds = "0" + intSeconds + " ";
- } else {
- seconds = intSeconds + " ";
- }
- timeString = theday + " " + xfile + " " + hours + minutes + seconds;
- //Clock.innerHTML = timeString;
- document.getElementById("Clock").innerHTML = timeString;
- window.setTimeout("tick();", 100);
- }
- window.onload = tick;
- </script>
- </head>
- <body>
- <div id="Clock" style="font-size: 12px">
- d</div>
- </body>
- </html>
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...