Onclick events In Java Script

This event occurs when the user clicks on an object. When the mouse left button is clicked on an object the onclick event fires to which we can connect with a functionality and can it programmed accordingly.
 
Example:
 
<html>

<head>

<title>events </title>

</head>

<body bgcolor=green text=yellow”>

<h4 align =center> Please Click the mouse on Image</h4>

<blockquote> The height & width of Image will get   increased</blockquote>

<img id=”img1″ src=”shark.jpg” height=100 width=100 onclick=”ff()”>

<script>

function ff()

{

document.all.img1.width=500 document.all.img1.height=500

}

</script>

</body>

</html>

Scroll to Top