Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // multilevel conditional - switch/case statement
- window.onload = initAll;
- function initAll() {
- document.getElementById("Mental").onclick
- = health;
- document.getElementById("Physical").onclick
- = health;
- document.getElementById("Spiritual").onclick
- = health;
- }
- function health() {
- switch(this.id) {
- case "Mental":
- alert("Play Sudoku");
- break;
- case "Physical":
- alert("Do yoga");
- break;
- case "Spiritual":
- alert("Meditate");
- break;
- default:
- }
- }
Add Comment
Please, Sign In to add comment