The code The HTML: Cow Pig Duck The JavaScript: function showSound() { var animal = this.id; if (animal === 'cow') alert('Mooo'); if (animal === 'pig') alert('Oink'); if (animal === 'duck') alert('Quack'); } function init() { document.getElementById('cow').onclick = showSound; document.getElementById('pig').onclick = showSound; document.getElementById('duck').onclick = showSound; } window.onload = init;