cfas

模拟JQUERY的延迟方法绑定,

对于延迟方法绑定,各种语言都有不同的描述

什么回调啊,函数指针啊,委托啊,事件啊等,其实也就是那么大回事,不过用好这些特性,对于扩展和架构是非常有好处的,

好处自然就不说啦,下面的这些代码仅供把玩,BUG和不兼容是有的,每次放列子,都有伙计叫我写完

我想说,写完了,我还会在这里写博客么,不如泡妹子

 

        <script type="text/javascript">
            $(\'t\').click(function() {
                alert(\'111\');
            });

            function $(e){
                return new jq(e);
            }

            function jq(e) {

                this.s =  document.getElementById(e);
                this.click = function(c) {
                    this.s.onclick = c;
                };
                this.change = function(c) {

                };
                this.val = function() {
                    return this.s.value;
                }
            }
         </script>

 

 

分类:

技术点:

相关文章:

  • 2021-12-22
  • 2021-09-20
  • 2022-12-23
  • 2021-06-11
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-15
  • 2021-10-21
  • 2021-12-31
  • 2021-05-24
  • 2021-12-14
  • 2021-10-27
相关资源
相似解决方案