代码如下:$(document).ready(function(){
$.extend({ show:function(){ alert("ready"); }});setInterval("$.show()",3000);});
方法2. 指定定时执行的函数时不要使用引号和括号。
代码如下:function show(){ alert("ready");}setInterval(show ,3000);// 注意函数名没有引号和括弧!