Do you want to be a good Web Developer?

Enter Your Email To Get Our Exclusive Tutorials
And Offer Right In Your Email

Javascript Events

Javascript Events

The web browser generates an event whenever something interesting happens to the document or browser or to some element or object associated with it. For eg. A web browser generates an event when a user hover an element or click on a element or submit the form etc.

Example of Event

<html>
<head>
<script type="text/javascript">

function demo() {
   alert("Hello Javascript");
}

</script>
</head>
<body>
<input type="button" onclick="demo()" value="Click Here" />
</body>
</html>

Result Of the Above Example


General Javascript Events


  • onchange: Script runs when the element changes

  • onsubmit: Script runs when the form is submitted

  • onreset: Script runs when the form is reset

  • onselect: Script runs when the element is selected

  • onblur: Script runs when the element loses focus

  • onfocus: Script runs when the element gets focus

  • onkey: Script runs when key is pressed

  • onkeypress: Script runs when key is pressed and released

  • onkeyup: Script runs when key is released

  • onclick: Script runs when a mouse click

  • ondblclick: Script runs when a mouse double-click

  • onmousedown: Script runs when mouse button is pressed

  • onmousemove: Script runs when mouse pointer moves

  • onmouseout: Script runs when mouse pointer moves out of an element

  • onmouseover: Script runs when mouse pointer moves over an element

  • onmouseup: Script runs when mouse button is released

PreviousNext

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email