添加时间显示
This commit is contained in:
parent
dfce476a0e
commit
bcec51fae6
23
css/body.css
23
css/body.css
@ -4,4 +4,25 @@ body, html {
|
||||
padding: 0;
|
||||
font-family: Arial, sans-serif; /* 默认字体 */
|
||||
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>
|
||||
<meta charset="utf-8">
|
||||
<title>DreamLife|HomePage</title>
|
||||
<link rel="stylesheet" href="homepage/css/footer.css">
|
||||
<link rel="stylesheet" href="homepage/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>
|
||||
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/body.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -40,11 +17,15 @@
|
||||
<li>目前网站工具箱以基本完善</li>
|
||||
<li>工具箱网站dreamlife.top/toolbox</li>
|
||||
</ul>
|
||||
<h2>您的当前区域时间</h2>
|
||||
<p id="timeDisplay">加载中...</p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>© 2025 DreamLife 版权所有</p>
|
||||
</footer>
|
||||
|
||||
<script src="javascape/time.js"></script>
|
||||
|
||||
</body>
|
||||
</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