html页面怎么获取当前时间?
<script language="javascript">
function get_time()
{vardate=newDate();varyear="",month="",day="",week="",hour="",minute="",second="";year=date.getFullYear();month=add_zero(date.getMonth()+1);day=add_zero(date.getDate());week=date.getDay();switch (date.getDay()) {case 0:val="周日";breakcase 1:val="周一";breakcase 2:val="周二";breakcase 3:val="周三";breakcase 4:val="周四";breakcase 5:val="周五";breakcase 6:val="周六";break}
hour=add_zero(date.getHours());
minute=add_zero(date.getMinutes());
second=add_zero(date.getSeconds());
document.getElementById("timetable").innerHTML=" "+year+"-"+month+"- "+day+" "+hour+":"+minute+":"+second+" "+val;
function add_zero(temp)
if(temp<10) return "0"+temp;
else return temp;
setInterval("get_time()",1000);
</script>
body 部分相应放时间的td或者div添加 id="timetable"