剑轩

js面向对象写法

电脑版发表于:2019/4/2 20:15


方法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)
    {
        
    }





关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢