故如虹,知恩;故如月,知明
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术

js面向对象写法

3776人阅读 2019/4/2 20:15 总访问:3919218 评论:0 收藏:0 手机
分类: Js相关


方法1:

 var cq = function()
 {
    this.init = function()
    {
    this.event();
    }
    
    this.create = function()
    {
    $('#child').html("<Ul><LI id='f'>a</LI> <LI id ='th'>b</LI> <LI id = 't'>c</LI></Ul>");
    }
    
    this.event = function()
    {
         var t = this; 
         $('#cq').bind('click', function() {
         t.create()//要调用本对象方法要在上边记录下this
         );
    }
  }

方法2:

  var zxprice = {};
    zxprice.qyportChoise = function (_qyporten)
    {
        
    }





欢迎加群讨论技术,群:677373950(满了,可以加,但通过不了),2群:656732739

评价