<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js動態顯示當前日期,時間和星期代碼</title>html
當前時間:<div id="time">
<script>
document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());
setInterval("document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script>
</div>
</body>
</html>ui