Onload Event Listener

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. if (typeof window.addEventListener != 'undefined')
  2. window.addEventListener('load', init, false);
  3. else if (typeof document.addEventListener != 'undefined')
  4. document.addEventListener('load', init, false);
  5. else if (typeof window.attachEvent != 'undefined')
  6. window.attachEvent('onload', init);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.