试图在单击时将EventListener添加到按钮上以向下滚动到div,但不能完全使其起作用。我还有其他与DOM一起使用的功能,所以我知道我的JS已正确链接。
const support = document.getElementsByClassName('support')
const support1 = document.getElementsByClassName('support1')
support.addEventListener('click', ((() => function aClickEvent(){
support1.scrollIntoView();
}))(), false);
<header class="nav">
<button class="support">Support</button>
</header>
<div id="welcome">
<h1 class="welc">TRIVIA</h1>
</div>
<div class="background"></div>
<div class="contact">
<div class="boxes">
<a href="questioneasy.html"> <div class="box">Easy</div></a>
<a href="questionmedium.html"> <div class="box1">Medium</div></a>
<a href="questionhard.html"> <div class="box2">Hard</div></a>
</div>
</div>
<div id='support1' class="support1">
<h1 class="contactnum"> Contact Number: 123-456-7890</h1>
</div>