js 重复执行

function hello(){
var shi = document.getElementById("player");
var a = shi.ended;
if(a == true){
window.location.href="lingquhongbao.php";
window.clearInterval(t2);
}
}
//重复执行某个方法
var t2 = window.setInterval("hello()",2000);

$(function(){

var interval = setInterval(increment,100);
var current = 0;

function increment(){
current++;
$('#counter').html(current+'%');
if(current == 100) { current = 0; }
}

$('.load-bar').mouseover(function(){
clearInterval(interval);
}).mouseout(function(){
interval = setInterval(increment,100);
});

});

猜你喜欢

转载自www.cnblogs.com/wangguizhong/p/12010847.html