javascript 中setTimeout 定时执行带参数的函数

    技术2022-05-20  52

    文章参考;http://www.360doc.com/content/08/0529/18/26857_1294638.shtml

     

    定时执行带参数的函数,具体详解请看文章参考。

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <mce:script type="text/javascript" src="Script/jquery-1.4.1.js" mce_src="Script/jquery-1.4.1.js"></mce:script> <mce:script type="text/javascript"><!-- $(function(){ function changeBgColor(change){ return function(){ change.css("color","red"); alert(change); } } $("#set").blur(function(){ var t = setTimeout(changeBgColor($(this)),2000); }); }) // --></mce:script> <mce:style type="text/css"><!-- --></mce:style><style type="text/css" mce_bogus="1"></style> </head> <body> <input type="text" id="set" /> </body> </html>  


    最新回复(0)