jquerylike wrap

时间:2014-11-06 12:16:34   收藏:0   阅读:234
 1 function $(selector){
 2  return new O(document.getElementById(selector));
 3 }
 4 function O(ele){
 5  this.ele=ele;
 6 }
 7 O.prototype.show=function(){
 8  this.ele.style.display=‘‘;
 9  return this;
10 };
11 O.prototype.hide=function(){
12  this.ele.style.display=‘none‘;
13  return this;
14 };
15 $(‘#id‘).show().hide();

 

原文:http://www.cnblogs.com/rocky2/p/4078080.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!