小编use*_*357的帖子

Javascript在悬停时播放声音.在hoveroff上停止并重置

function EvalSound(soundobj) {
    var thissound=document.getElementById(soundobj);
    thissound.currentTime = 0;  
    thissound.Play();
}

function StopSound(soundobj) {
    var thissound=document.getElementById(soundobj);
    thissound.Stop();
}
Run Code Online (Sandbox Code Playgroud)

这是我播放音频文件的代码,

onmouseover="EvalSound('sound1')" onmouseout="StopSound('sound1')"
Run Code Online (Sandbox Code Playgroud)

它目前正在进行悬停,但是当我回到它下面播放的图像时它不会回到开头,它会继续播放

javascript audio onmouseover onmouseout onhover

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

audio ×1

javascript ×1

onhover ×1

onmouseout ×1

onmouseover ×1