utils.extend(document.getElementById('ss'), Listeners);

解决方案 »

  1.   

    if(!args[1])args = [this,args[0]];     ====》 if(!args[1])args == [this,args[0]];   
      

  2.   

    <html>
    <script>
    var utils = {};
    utils.extend = function()   
    {
     
        var args = arguments;
        if(!args[1])args = [this,args[0]];                                          
        for(var property in args[1])
    {
    alert(args[0]);
    args[0][property] = args[1][property];            
    }
        return args[0];
    };
    var    Listeners = {

        addListener : function(type,fn)
        {
            if(this.addEventListener)this.addEventListener(type, fn, false); 
            else this.attachEvent('on' + type, fn);
            return this;
        },
        removeListener : function(type, fn)
        {
            if(this.removeEventListener)this.removeEventListener(type, fn, false);   
            else this.detachEvent('on' + type, fn);
            return this;
        }
    };function sss(){
        alert('a')
    }
    </script>
    <body>
    <div id='ss' style=" height:200px; width:500px; background-color:#0066CC"></div>
    <script>
    utils.extend(document.getElementById('ss'), Listeners);
    document.getElementById('ss').addListener('click',sss);</script>
    </body>
    </html>