Posted By

mlange on 10/03/06


Tagged

MVC


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

configuration


javascript MVC


 / Published in: JavaScript
 

URL: http://blindmindseye.com/2006/01/31/javascript-mvc/

  1. <html>
  2. <head>
  3. <script type=”text/javascript” xsrc=”js-mvc.js” mce_src=”js-mvc.js/> </head>
  4. <body onload=”init()>
  5. <form>
  6. <input type=”button” id=”myBtn” name=”myBtn”/>
  7. <p id=”label”>0 clicks</p> </form>
  8. </body>
  9. </html>
  10.  
  11. var myBtn = null;var label = null;
  12.  
  13. function init()
  14.  
  15. {
  16.  
  17. myBtn = document.getElementById(”myBtn”);
  18.  
  19. label = document.getElementById(”label”);
  20.  
  21. myBtn.onclick = myBtnOnClick;
  22.  
  23. }
  24.  
  25. function myBtnOnClick()
  26.  
  27. {
  28.  
  29. var labelContents = parseInt(label.innerHTML);
  30.  
  31. labelContents++;
  32.  
  33. label.innerHTML = labelContents + ” clicks”;
  34.  
  35. }

Report this snippet   <

You need to login to post a comment.