jquery中使用setInterval,js循环执行
<!doctype html>
<html><head>
<meta charset="utf-8">
<title>jquery中setInterval的使用 </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript">
$(function(){
$.show = function() {
$("#show").show(400,function(){
$(this).hide(400);
}
);
};
clearInterval(test); //清理一次,下面再执行
var test = setInterval(function(){
$.show();
},800);
});
</script>
<style>
#show{ display:none;}
</style>
</head>
<body>
<div id="show">jquery中clearInterval的使用,每隔4000毫秒执行一次 </div>
</body>
</html>