此代码试图在html中使用类名的按钮上添加声音有什么问题
var drumlenght = querySelectorAll(".drum").length
for (var i = 0; i < drumlenght; i++) {
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
alert("hi")
});
}
此代码尝试在HTML中使用类名称在按钮上添加声音有什么问题。
var drumlenght = querySelectorAll(".drum").length
for (var i = 0; i < drumlenght; i++) {
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
alert("hi")
});
}
whats wrong with this code trying to add sound on buttons with class name .drum
in html.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您代码的正确结构:)
提示
var
使用严格的
模式,This is the right structure of your code :)
tips
var
use strict
mode on,