35行的山寨版jQuery-创新互联
jQuery对象本质上是一种类数组对象
var $$ = function (nodeList) {
return new $$.fn.init(nodeList);
};
$$.fn= $$.prototype = {
toString:function () {
return this.slice();
},
constructor: $$,
init:function ( arr ) { // 创建类数组对象 for (var i = 0, l = arr.length; i
使用示例:![35行的山寨版jQuery
35行的山寨版jQuery](/upload/otherpic41/2124541.jpg)
var para = $$( document.getElementsByTagName('p') );
para.each(function(){
this.className += " " + 'goodbye';
});
当前题目:35行的山寨版jQuery-创新互联
地址分享:http://myzitong.com/article/jdcdi.html