<button onclick="myFunction()">Click me</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = "Hello World"; } </script>
var myElem = document.getElementByID('ElemID'); myElem.onclick = function() { //do stuff }
<button onClick="script">
<img src="hospital.png" id="hospitals" onclick="damarkers();">