标签:http java javascript html io htm
$.extend(target,prop1,propN)
用一个或多个其他对象来扩展一个对象,返回这个被扩展的对象。这是简化继承的主要工具。
返回值:Object
参数:
示例:
合并settings和options, 修改并返回settings
var settings = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; jQuery.extend(settings, options);
结果:
settings == { validate: true, limit: 5, name: "bar" }
示例:
合并defaults和options, 但不修改defaults,返回合并后的对象
ar defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; var settings = jQuery.extend({}, defaults, options);
结果:
settings == { validate: true, limit: 5, name: "bar" }
http://www.jz123.cn/shouce/jQuery/JavaScript/$.extend.html
标签:http java javascript html io htm
原文地址:http://www.cnblogs.com/mabelstyle/p/3824913.html