DOM Scripting vs jQuery 1: "Hola mundo"


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



Copy this code and paste it in your HTML
  1. /*DOM Scripting*/
  2. function addLoadEvent(func) {
  3. var oldonload = window.onload;
  4. if (typeof window.onload != 'function') {
  5. window.onload = func;
  6. } else {
  7. window.onload = function() {
  8. oldonload();
  9. func();
  10. }
  11. }
  12. }
  13.  
  14. function mostrarVentana(){
  15. alert('Hola mundo sin jQuery');
  16. }
  17.  
  18. addLoadEvent(mostrarVentana);
  19.  
  20.  
  21. /*jQuery*/
  22. $(document).ready(function(){
  23. alert('Hola mundo con jQuery');
  24. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.