zl程序教程

您现在的位置是:首页 >  前端

当前栏目

jQuery Timers 定时插件使用详解编程语言

jQuery插件编程语言 使用 详解 定时 Timers
2023-06-13 09:20:24 时间

 JQuery Timers提供了三个函式

1. everyTime(时间间隔, [定时器名称], 函式名称, [次数限制], [等待函式程序完成])
2. oneTime(时间间隔, [定时器名称], 呼叫的函式)
3. stopTime ([定时器名称], [函式名称])

 !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" 

 html 

 head 

 meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/ 

 title New Document /title 

 meta name="Generator" content="EditPlus" 

 meta name="Author" content="" 

 meta name="Keywords" content="" 

 meta name="Description" content="" 

 script src="jquery-1.4.2.js" /script 

 script src="jquery.timers-1.1.2.js" /script 

 /head 

 body 

 button id="btn1" 每一秒执行 /button 

 nbsp; 

 button id="btn2" 清除每二秒执行 /button 

 nbsp; 

 button id="btn3" 执行3次停止 /button 

 /body 

 /html 

 script 

1. everyTime(时间间隔, [计时器名称], 函式名称, [次数限制], [等待函式程序完成]) 

2. oneTime(时间间隔, [计时器名称], 呼叫的函式) 

3. stopTime ([计时器名称], [函式名称]) 

$(document).ready( 

function(){ 

 /*******每二秒执行********/ 

 $("#btn1").click(function(){ 

 $(body).everyTime(2s,ds1,function (){ 

 console.log("每二秒执行"); 

 }); 

 }); 

 /*******每二秒执行********/ 

 /*******清除每二秒执行********/ 

 $("#btn2").click(function(){ 

 $(body).stopTime (ds1); 

 console.log("已清除每二秒执行"); 

 }); 

 /*******清除每二秒执行********/ 


原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/8616.html

cjava