?如果我省去兩句return?this,會怎么樣?function?base(){????????????this.elements=[];????????????this.getid=function(id){???????????this.elements.push(document.getElementById(id));????????????????return?this;????????????};????????????this.gettag=function(tagname){????????????????var?tags=document.getElementsByTagName(tagname);????????????????for(var?i=0;i<tags.length;i++){????????????????this.elements.push(tags[i]);????????????};????????????????return?this;??????????};????????};為什么需要return this呢
關(guān)于return this的一個疑問,求大神解答
天瑜CJT
2014-11-06 12:21:46