The code The HTML: Cow Pig Duck Fox The JavaScript: function showSound() { var animal = this.id; switch (animal) { case 'cow': alert('Mooo'); break; case 'pig': alert('Oink'); break; case 'duck': alert('Quack'); break; default: alert("I haven't a clue. What does the " + animal + " say?"); } } function init() { document.getElementById('cow').onclick = showSound; document.getElementById('pig').onclick = showSound; document.getElementById('duck').onclick = showSound; document.getElementById('fox').onclick = showSound; } window.onload = init;