日期:2014-05-16  浏览次数:21464 次

如何获取系统当前时间?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<script type="text/javascript" language="javascript">
var a=new Date();
setInterval("document.getElementById('time').innerHTML=a.getFullYear()+'年'+a.getMonth()+'月'+a.getDate()+'日&nbsp;&nbsp;星期'+'日一二三四五六'.charAt(a.getDay());+a.getHours()+'点'+a.getMinutes()+'分'+a.getSeconds()+'秒'",1000);
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<table width="100%" border="0">
  <tr>
    <td id="time" align="right"></td>
  </tr>
</table>
</body>
</html>

------解决方案--------------------

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" language="javascript"> 
window.onload=function(){
setInterval(function(){
var a=new Date(); 
document.getElementById('time').innerHTML=a.getFullYear()+'年'+a.getMonth()+'月'+a.getDate()+'日&nbsp;&nbsp;星期'+'日一二三四五六'.charAt(a.getDay())+a.getHours()+'点'+a.getMinutes()+'分'+a.getSeconds()+'秒';
}, 1000);
}
</script>
</head>
<body>
<table width="100%" border="0">
<tr>
<td id="time" align="right" />
</tr>
</table>
</body>
</html>


------解决方案--------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<script>setInterval("time.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<table width="100%" border="0">  <tr>    <td id="time" align="right"></td>  </tr></table>
</body>
</html>
------解决方案--------------------
<SCRIPT LANGUAGE="JavaScript">

document.write("<span id='time'></span>")
setInterval("time.innerText=new Date().toLocaleString()",1000)

</SCRIPT>