无法找到我的页面为什么不更新。控制台窗口显示innerHTML但未显示。有人请帮忙,告诉我我哪里出问题了。
HTML
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="css.css">
</head>
<body>
<div class="box">
<h1 class="head">Project Clock</h1>
<h3>Time</h3><br>
<span class="date">gvgjhvgh</span>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcROL-uvXtjeCujLSWKeqTJ0vwrRwGLHmwKLD2wDzuvIwVQqOj-g"/>
<h2 class="party">Party Time</h2>
<h1>Set Wake up time</h1>
<button type="button" class="btn btn-dark">Dark</button>
</div>
<script src="js1.js"></script>
</body>
</html>
JavaScript
class dates
{
constructor()
{
var d=new Date();
var date=d.getDate();
var mon=d.getMonth();
var year=d.getFullYear();
var ret=`${date} / ${mon} / ${year}`;
var ele=document.getElementsByClassName("date");
ele.innerHTML=ret;
}
}
var obj=new dates();