大屏页面添加了个时钟
<html>
<script>
window.onload = function() {
var clockDate = document.getElementById('clockDate');
var clockWeek = document.getElementById('clockWeek');
var clockTime = document.getElementById('clockTime');
var week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; //星期数组
var color = ['red', 'green', 'yellow', 'blue', 'black', 'gold', 'orange', 'gray', 'pink', 'maroon']; //钟表颜色数组
setInterval(function() {
var now = new Date();
clockDate.innerHTML = now.getFullYear() + '年' + (now.getMonth()+1) + '月' + now.getDate() + '日';
clockTime.innerHTML = + now.getHours() + '时' + now.getMinutes() + '分' + now.getSeconds()+'秒';
clockWeek.innerHTML = week[now.getDay()];
// var radom = Math.floor(Math.random() * color.length + 1) - 1; //随机数
// clock.style.color = color[radom]; //设置随机颜色
}, 1000)
}
</script>
<body>
<div id="clockDate" style="font-size:20px;text-align:center;"></div>
<div id="clockWeek" style="font-size:25px;text-align:center;"></div>
<div id="clockTime" style="font-size:20px;text-align:center;"></div>
</body>
</html>