In my HTML web page I have an image and I would like to trigger a javascript function when the image is clicked. Here is the codes:
<img src="pond1.jpg" height="150" size="150" alt="Johnson Pond" onclick="imagefunction()"> <script> function imagefunction() { alert("Hello world") } </script>
The problem is that by clicking on the image nothing happens.
How can we get onclick event on img tag?
Anonymous Asked question May 14, 2021
Recent Comments