<p id="akapit1">Akapit 1</p> <button id="bt1" onclick="zrodlo(this)">Przycisk 1</button> <button id="bt2">Przycisk 2</button> <button id="bt3">Przycisk 3</button> <script> function zrodlo(obiekt) { document.getElementById("akapit1").innerHTML = "Zdarzenie wywołał " + obiekt.innerHTML; } document.getElementById("bt2").onclick = function() {zrodlo(this)}; document.getElementById("bt3").addEventListener("click", function() {zrodlo(this)}); </script>
Akapit 1
https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event
https://developer.mozilla.org/en-US/docs/Web/Events