dom js

 

 

           var addEvent = function( obj, type, fn ) { 
                if (obj.addEventListener) 
                    obj.addEventListener( type, fn, false ); 
                else if (obj.attachEvent) { 
                    obj["e"+type+fn] = fn; 
                    obj.attachEvent( "on"+type, function() { 
                        obj["e"+type+fn](); 
                    }); 
                } 
            };
相關文章
相關標籤/搜索