<script type="text/javascript">
// function settime() {
// var mytime = document.getElementByIdx_x_x("mytime");
// var time = new Date();
// var text = time.toString();
// mytime.innerHTML = text;
// // alert(time);
// }
// setInterval(settime, 1000);
// settime();
function showTime() {
var temp = "";
var week = new Array("星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")//0代表星期天,1代表星期一
var timeNow = new Date();
var h = timeNow.getHours();
var s = timeNow.getSeconds();
var m = timeNow.getMinutes();
var year = timeNow.getYear();
var month = timeNow.getMonth() + 1; //返回0-11
var i = timeNow.getDay()
var xingqi = week[i];
var day = timeNow.getDate(); //返回1-31
if (h < 10) h = "0" + h;
if (m < 10) m = "0" + m;
if (s < 10) s = "0" + s;
temp = "现在是:" + year + "年" + month + "月" + day + "日 " + xingqi + " " + h + ":" + m + ":" + s;
mytime.innerHTML = temp; //mytime为页面元素的一个id号
//var t=setTimeout("showTime()",1000);
}
setInterval(showTime, 1000);
</script>
<span id="mytime"></span>