완전한 코드는 여기에서 찾을 수 있습니다 : http://www.webdeveloper.com/forum/showthread.php?t=224180#6 이것은 jquery와 같은 기능을 에뮬레이트합니다. 다음 부분은 방법을 정의합니다.누군가가이 부분의 방법을 설명 할 수 있습니까
//define some methods for the utility:
var meths={
hide:function(a){if(a)a.style.display="none";},
show:function(a){if(a)a.style.display="";},
remove:function(a){if(a)a.parentNode.removeChild(a);},
color:function(a){a.style.color=this||a.style.color;},
size:function(a){if(a)a.style.fontSize=this||a.style.fontSize;}
};//end meths
나는이 부분을 얻습니다. 물론 이것은 종결의 일부입니다. 나는 다음 부분을 이해하는 것 그리고 X.hide()
를 호출하는 방법을 사람이
//bind the methods to the collection array:
for(var meth in meths)
(function(n,m){
output[n]=function(x){output.map(m,x); return output;}
}(meth, meths[meth]));//next method
return output;
설명 할 시간이 걸릴 것입니다 경우 X에서 해당 메소드를 호출 할 수 방법이 부분 어떻게? –