添加时间显示
This commit is contained in:
parent
dfce476a0e
commit
bcec51fae6
21
css/body.css
21
css/body.css
@ -5,3 +5,24 @@ body, html {
|
|||||||
font-family: Arial, sans-serif; /* 默认字体 */
|
font-family: Arial, sans-serif; /* 默认字体 */
|
||||||
background-color:#f4f4f4;
|
background-color:#f4f4f4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*主内容区test*/
|
||||||
|
.container {
|
||||||
|
width: 60%;
|
||||||
|
margin: 10% auto 0;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
padding: 2% 5%;
|
||||||
|
border-radius: 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul li {
|
||||||
|
line-height: 2.3
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #20a53a
|
||||||
|
}
|
31
index.html
31
index.html
@ -3,31 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>DreamLife|HomePage</title>
|
<title>DreamLife|HomePage</title>
|
||||||
<link rel="stylesheet" href="homepage/css/footer.css">
|
<link rel="stylesheet" href="css/footer.css">
|
||||||
<link rel="stylesheet" href="homepage/css/body.css">
|
<link rel="stylesheet" href="css/body.css">
|
||||||
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
width: 60%;
|
|
||||||
margin: 10% auto 0;
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
padding: 2% 5%;
|
|
||||||
border-radius: 10px
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
padding-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul li {
|
|
||||||
line-height: 2.3
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #20a53a
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -40,11 +17,15 @@
|
|||||||
<li>目前网站工具箱以基本完善</li>
|
<li>目前网站工具箱以基本完善</li>
|
||||||
<li>工具箱网站dreamlife.top/toolbox</li>
|
<li>工具箱网站dreamlife.top/toolbox</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h2>您的当前区域时间</h2>
|
||||||
|
<p id="timeDisplay">加载中...</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2025 DreamLife 版权所有</p>
|
<p>© 2025 DreamLife 版权所有</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="javascape/time.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
9
javascape/time.js
Normal file
9
javascape/time.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//获取计算机的时间信息
|
||||||
|
function updateLocalTime() {
|
||||||
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
const now = new Date().toLocaleString('zh-CN', { timeZone: timezone });
|
||||||
|
document.getElementById('timeDisplay').innerText = `当前时间 (${timezone}): ${now}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(updateLocalTime, 1000); // 每秒更新时间
|
||||||
|
window.onload = updateLocalTime;
|
Loading…
x
Reference in New Issue
Block a user