当前位置: 代码迷 >> JavaScript >> 显示时间的语句解决方案
  详细解决方案

显示时间的语句解决方案

热度:59   发布时间:2012-05-14 15:24:34.0
显示时间的语句
显示时间的语句如下:
<script type=text/javascript>
document.write("<span id='labtime' width='120px' Font-Size='9pt'></span>")
setInterval("labtime.innerText=new Date().toLocaleString()",1000)
</script>
有错吗?为什么在这个时间在程序中无法显示?

------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="gb2312" />
        <title></title>
    </head>
    <body>
<script type=text/javascript>
document.write("<span id='labtime' width='120px' Font-Size='9pt'></span>")
setInterval(function(){document.getElementById('labtime').innerHTML=new Date().toLocaleString()},1000)
</script>

    </body>
</html> 
  相关解决方案