标签:charset start 自定义 min style 页面 inner new tar
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>show_time</title>
<style>
body {
padding-top: 40px;
}
#main {
margin: auto;
text-align: center;
width: 300px;
height: 200px;
background-color: #0CC;
}
#show_time0,#show_time {
width:300px;
height:100px;
color: #FFF;
}
</style>
<script>
//定义转换日期格式函数:Format()
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//获取系统日时并转换格式
var start_time = new Date().Format("yyyyMMdd"+"000000");
</script>
</head>
<body>
<div id="main">
<div id="show_time0" style="">
<script>
//将时间显示到页面中
setTimeout("show_time0.innerHTML=start_time;",1000);
</script>
</div>
</div>
</body>
</html>
标签:charset start 自定义 min style 页面 inner new tar
原文地址:https://www.cnblogs.com/lovehansong/p/10418492.html