Wednesday, July 23, 2014

Actions and Events

When we click on the button we need something to happen and some code to execute we have some special functions we can use them when a button clicked or a key pressed lets see some of them now

  •  OnClick function: this function can be used when you click on your mouse on Button,text,link.....kinda all HTML elements lets see this example:
  • Onkeypress: this will call out function everytime we press a key on the keyboard and we usually use this in the Text Boxes for example if we wont a immediate validation lets see this :



  • onload: this can be used only in the <body> tag this will call the function only when the page finish loading of all its contents 

  • onblur: this is a good way for validation this will call the function when we click on the text box and then click out of the text box i mean it calls when the text box lose focus 

  • onmouseover: you can know this by its name this will call the function when the mouse is over our HTML element we can use this on images when the user move the mouse over the image we can make it bigger and we'll see this later.
  • onkeydown: the events will occurs while the user is pressing a key 
  • ondbclick: this will call function when you click double click on the element 
  • onmouseenter: the events will occurs when the mouse enter the element 
there's much more events which we'll see in the next article ,Have a nice day guys 

No comments:

Post a Comment