This commit is contained in:
赵鑫 2022-09-03 14:56:14 +08:00
parent f338ddac43
commit c084648b9b

View File

@ -33,7 +33,7 @@
</header>
<section class="课程表">
<img src="images/ryan.png" height="80px">
<span class="date">Today is <span id="weekday1"></span>.</span>
<span class="date">今天是<span id="weekday1"></span></span>
<table>
<thead>
<tr>
@ -107,7 +107,7 @@
</section>
<section class="课程表">
<header>
<span class="date">今天是周<span id="weekday2"></span></span>
<span class="date">今天是周<span id="weekday2"></span></span>
<img src="images/little_cat.png" height="80px">
</header>
<table>
@ -182,11 +182,12 @@
</table>
</section>
<script>
const today = new Date()
const weekday = today.getDay()
const now = new Date()
const weekday = now.getDay()
const day = "日一二三四五六"[weekday]
document.querySelector("#weekday1").innerText = today.toLocaleDateString()
document.querySelector("#weekday2").innerText = day
const date = `${now.getFullYear()}年${now.getMonth() + 1}月${now.getDate()}日`
document.getElementById("weekday1").innerText = date
document.getElementById("weekday2").innerText = day
if (weekday > 0 && weekday < 6)
document.querySelectorAll(`tr td:nth-child(${weekday + 1})`).forEach(cell => {
cell.style.color = "#ff7"