js 回调函数
function startMove(obj,json,fnEnd){
// 链接的不能用this this--》window
/* if(fn)
{ fn(); } */
// 链接的能用this
if(fn)
{ fn.call(obj);}
}
扩展jQuery对象本身
jQuery.extend({
min: function(a, b) { return a < b ? a : b; },
max: function(a, b) { return a > b ? a : b; }
});
jQuery.min(2,3); // => 2
jQuery.max(4,5); // => 5
扩展 jQuery 元素集来提供新的方法(通常用来制作插件)
jQuery.fn.extend({
check: function() {
return this.each(function() { this.checked = true; });
},
uncheck: function() {
return this.each(function() { this.checked = false; });
}
});
$("input[type=checkbox]").check();
$("input[type=radio]").uncheck();