用html帮我写一个时间代码,要求有年月日时分秒星期,白色字体,兼容64位windows
时间: 2023-03-27 09:02:33 浏览: 84
以下是使用 HTML 编写的时间代码,包括年月日时分秒星期,白色字体,兼容 64 位 Windows:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>时间代码</title>
<style>
body {
background-color: black;
color: white;
font-size: 30px;
font-family: Arial, sans-serif;
text-align: center;
}
</style>
</head>
<body>
<script>
function updateTime() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
var week = ['日', '一', '二', '三', '四', '五', '六'][now.getDay()];
document.body.innerHTML = year + '年' + month + '月' + day + '日 ' + hour + ':' + minute + ':' + second + ' 星期' + week;
}
setInterval(updateTime, 100);
</script>
</body>
</html>
```
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)