HTML页面显示动态显示时间(2)
2023-05-02 来源:飞速影视
text-align: center;
font: bold;
color: red;
}
</style>
<script>
function showTime(clock){
var now = new Date();
var year = now.getFullYear();
var month= now.getMonth();
var day = now.getDate();
var hour = now.getHours();
var minu = now.getMinutes();
var second = now.getSeconds();
month = month 1;
var arr_work = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var week = arr_work[ now.getDay()];
var time = year "年" month "月" day "日 " week " " hour ":" minu ":" second;
clock.innerHTML="当前时间: " time;
window.onload = function(){
var clock = document.getElementById("clock");
window.setInterval("showTime(clock)",1000);
</script>
</head>
<body>
<div id ="clock"></div>
</body>
</html>
本站仅为学习交流之用,所有视频和图片均来自互联网收集而来,版权归原创者所有,本网站只提供web页面服务,并不提供资源存储,也不参与录制、上传
若本站收录的节目无意侵犯了贵司版权,请发邮件(我们会在3个工作日内删除侵权内容,谢谢。)
www.fs94.org-飞速影视 粤ICP备74369512号