Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via 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

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH

Check Out SEMRUSH