Posted By

marcio on 02/15/08


Tagged

javascript events EventHandler


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

iTony


add event


 / Published in: JavaScript
 

  1. function hazCosasMaravillosasConElDOM() {}
  2.  
  3. //addEvent() by John Resig
  4. function addEvent( obj, type, fn ){
  5. if (obj.addEventListener){
  6. obj.addEventListener( type, fn, false );
  7. }
  8. else if (obj.attachEvent){
  9. obj["e"+type+fn] = fn;
  10. obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); }
  11. obj.attachEvent( "on"+type, obj[type+fn] );
  12. }
  13. }
  14.  
  15. addEvent(window, 'load', hazCosasMaravillosasConElDOM);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: sosof on February 17, 2008

good

You need to login to post a comment.