Guest User

Untitled

a guest
Oct 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // multilevel conditional - switch/case statement
  2. window.onload = initAll;
  3.  
  4. function initAll() {
  5. document.getElementById("Mental").onclick
  6. = health;
  7. document.getElementById("Physical").onclick
  8. = health;
  9. document.getElementById("Spiritual").onclick
  10. = health;
  11. }
  12.  
  13. function health() {
  14. switch(this.id) {
  15. case "Mental":
  16. alert("Play Sudoku");
  17. break;
  18. case "Physical":
  19. alert("Do yoga");
  20. break;
  21. case "Spiritual":
  22. alert("Meditate");
  23. break;
  24. default:
  25. }
  26. }
Add Comment
Please, Sign In to add comment