js+html获取系统当前时间


本文实例为大家分享了html获取系统当前时间的具体代码,供大家参考,具体内容如下

<html>
<head>
<STYLE>
TD {
FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
</STYLE>
<SCRIPT language=JavaScript>
function tick() {
var years,months,days,hours, minutes, seconds;
var intYears,intMonths,intDays,intHours, intMinutes, intSeconds;
var today;
today = new Date(); //系统当前时间
intYears = today.getFullYear(); //得到年份,getFullYear()比getYear()更普适
intMonths = today.getMonth() + 1; //得到月份,要加1
intDays = today.getDate(); //得到日期
intHours = today.getHours(); //得到小时 
intMinutes = today.getMinutes(); //得到分钟
intSeconds = today.getSeconds(); //得到秒钟
years = intYears + "-"; 

if(intMonths < 10 ){
months = "0" + intMonths +"-";
} else {
months = intMonths +"-";
}
if(intDays < 10 ){
days = "0" + intDays +" ";
} else {
days = intDays + " ";
}
if (intHours == 0) {
hours = "00:";
} else if (intHours < 10) {
hours = "0" + intHours+":";
} else {
hours = intHours + ":";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = years+months+days+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 1000);
}
window.onload = tick;
</SCRIPT>
</head>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR bgColor=#73a3d4 height=40>
<TD noWrap align=right width=209 ><SPAN id="Clock"></SPAN></TD>
</TR>
</TABLE>
</BODY>
</HTML>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持积木网。

three.js加载obj模型的实例代码
three.js是一款webGL框架,由于其易用性被广泛应用。如果你要学习webGL,抛弃那些复杂的原生接口从这款框架入手是一个不错的选择。好了,下面通过一

Three.js加载外部模型的教程详解
1.首先我们要在官网:https://threejs.org/下载我们three.js压缩包,并将其中的build文件夹下的three.js通过script标签对的src属性导入到我们的页面中2.创建three.js核

JS实现移动端整屏滑动的实例代码
基本思路:1)检测手指滑动方向:获取手指抬起时的位置,减去手指按下时的位置,得正即为向下滑动了2)手指抬起后,向对应反向操作改变当前页的