11月
19日

有趣的JavaScript实现的节拍器(没有使用插件)

类归于: 做东西 Hbomb 写于 17:35

当点亮下面节拍器的按钮,就能发出相应的声音来,感觉非常好玩

主要是基于不用flash,文件JS实现声音播放的原理做的

function startWav(uri) {
stopWav();
embedEl = document.createElement(”embed”);
embedEl.setAttribute(”src”, uri);
embedEl.setAttribute(”hidden”, true);
embedEl.setAttribute(”autostart”, true);

document.body.appendChild(embedEl);
}

通过embed来实现的

原理的文章