在网页上可以显示当前时间的控件是?我是菜鸟~
可以用lable来作为显示当前时间的控件吗
比如显示“今天是2012年2月28日 星期二”
但是怎么与当前时间关联呢
谢大侠~
[解决办法]
asp.net页放个Label,比如ID:lblNowDate
.cs文件Load事件中---->lblNowDate.Text = DateTime.Now.ToString();
当然时候格式化,可以根据你的需求自己来
[解决办法]
<b>现在是:<span id="thetime"></span></b><script type="text/javascript">var timerID = null;var timerRunning = false;function stopclock() { if (timerRunning) clearTimeout(timerID); timerRunning = false;}function startclock() { stopclock(); showtime();}function showtime() { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() var timeValue = now.getFullYear() + "年" + (now.getMonth() + 1) + "月" + now.getDate() + "日 " timeValue += hours timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds document.getElementById("thetime").innerHTML = timeValue; timerID = setTimeout("showtime()", 1000); timerRunning = true;}</script>