日期:2014-05-18 浏览次数:20927 次
<html> <head> <script type="text/javascript"> setInterval("div1.innerHTML=new Date().toLocaleString();",1000); </script> </head> <body> <div id='div1'></div> </body> </html>
------解决方案--------------------
label在前台会渲染成span的,取span的ID,再赋值就可以了。
------解决方案--------------------
http://blog.csdn.net/xianfajushi/article/details/6028088
------解决方案--------------------
<script type="text/javascript" language="javascript">
<!--
function show_date_time()
{
window.setTimeout("show_date_time()", 1000);
today=new Date();
document.getElementById("label1").innerHTML="现在是"+today.getYear()+"年"+(today.getMonth()+1)+"月"+today.getDate()+" 日"+today.getHours()+"时"+today.getMinutes()+"分"+today.getSeconds()+"秒";
}
-->
</script>
</head>
<body onload='show_date_time()'>
<form id="form1" runat="server">
<div>
<label id='label1'></label>
</div>
</form>
</body>
------解决方案--------------------
<script type="text/javascript" language="javascript">
var timer0 = null;
var week = new Array("日", "一", "二", "三", "四", "五", "六");
timer0 = setTimeout(showTime, 100);
function showTime() {
clearTimeout(timer0);
var dt = new Date();
var result = dt.toLocaleDateString() + dt.toLocaleTimeString();
$("#timePlace").html(result);
timer0 = setTimeout(showTime, 1000);
}
</script>
<span id='timePlace'></span>
------解决方案--------------------
你的innerHTMl后面根本就没有赋值 肯定不显示啦