不使用Timer控件显示时间的方法:
<script type="text/javascript" language="javascript">
function updateTime()
{
var label = document.getElementById('ctl00_ContentPlaceHolder1_currentTime');
if (label) {
var time = (new Date()).toLocaleTimeString();
time = time.match(/^(\s*\d{1,2}\s*\:\s*\d{1,2}\s*\:\s*\d{1,2}\s*[A-Za-z]{2}).*$/)[1];
label.innerHTML = time;
}
}
updateTime();
window.setInterval(updateTime, 1000);
</script>
function updateTime()
{
var label = document.getElementById('ctl00_ContentPlaceHolder1_currentTime');
if (label) {
var time = (new Date()).toLocaleTimeString();
time = time.match(/^(\s*\d{1,2}\s*\:\s*\d{1,2}\s*\:\s*\d{1,2}\s*[A-Za-z]{2}).*$/)[1];
label.innerHTML = time;
}
}
updateTime();
window.setInterval(updateTime, 1000);
</script>