惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
D
Docker
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
D
DataBreaches.Net
月光博客
月光博客
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学

博客园 - 黄毅.net

获取oracle 表字段,表名,以及主键之类等等的信息。 关于.net操作Oracle数据库,parameters参数顺序的问题。 .net 处理xml 查找节点 属性 添加节点 - 黄毅.net Jmail组件使用方法(asp) access存储和读取二进制字段数据 如何让数据库排序的时候按照中文的拼音来排序 flash不合js冲突(js菜单会飘到flash下面) & 不剪断代码透明化 - 黄毅.net DateAdd函数使用方法 【winform】datagridview绑定到arraylist的时候,arraylist元素变化而dgv不变的解决。 treeview显示数据表树结构。 asp读写txt操作 - 黄毅.net - 博客园 读取硬盘id (这个好像仅限于ide硬盘) 播放器嵌入代码 url传递中文的解决方案总结 Js验证是否为数字 执行完asp,然后把html写进静态页面(功能类型于spider,还是xmlhttp的) 一个分页的sp,从aspnetpager过来的 网站测试技术简介 验证email正则js
js显示日期 - 黄毅.net - 博客园
黄毅.net · 2007-12-02 · via 博客园 - 黄毅.net

完整显示当前日期和时间的JS代码

  代码演示效果为“2007年2月25日星期日正午12:42:48”。
  使用方法:将下面的JS代码放到你想要显示的页面中(支持HTML页面),然后在你想要显示时间的位置插入下面的代码即可

<div id="Clock" align="center" style="font-size: 12px; color:#000000"></div>

  JS代码如下:

<script>
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=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
theday = today.getYear()+"年" + [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 {
intHours = 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;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script>

  比较实用的代码,值得珍藏^_^