The code The HTML: Cow Pig Duck Fox The JavaScript: function showSound() { var animal = this.id; if (animal === 'cow') alert('Mooo'); else if (animal === 'pig') alert('Oink'); else if (animal === 'duck') alert('Quack'); else alert("I don't know. 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;