鼠标悬停时循环开始很好,但鼠标悬停时并没有停止!我究竟做错了什么?
脚本
<script type="text/javascript">
function iniciarep(x) {
var iddointervalo = setInterval(function(){ change(x); }, 500);
}
function terminarep() {
clearInterval(iddointervalo);
}
function change(x) {
**do stuff here (working fine)**
}
</script>
Run Code Online (Sandbox Code Playgroud)
的HTML
<img id="c3" src="letras/m1.svg" alt="m" onmouseover='iniciarep(this);' onmouseout='terminarep();'>
Run Code Online (Sandbox Code Playgroud)