How to Associate Methods by Using Button.

Spread the love

In my last post https://www.techtravelhub.com/2012/11/how-to-create-button-in-web.html I have shown how a button is created in web page.

In this post I will write how to insert or triggers method by using button.

 let us check what are the methods a button supports…



TypeMethodsDetails
Methodsblur()It removes the focus from a button
click()Most commonly used method with button. It calls the event handler function defined by developer
focus()This is a method triggered when a button gains focus
handleEvent()This throws an event to correct event handler


let us also check the Event handlers associated with a button:

TypeEvent HandlersDetails
Event HandlersonBlurThis event occurs when focus is removed from a button. This handler got activated
onClickThis event occurs when user clicks on a button. This handler got activated
onFocusThis event occurs when a button gain focus.This handler got activated
onMouseDownThis is similar to click but only activated when a mouse click is done.This handler got activated.Mostly used secure website where mouse click is allowed
onMouseUpThis is similar to click but only activated when a mouse click is done to deselect a button.This handler got activated.Mostly used secure website where mouse click is allowed

Supported Environments:

Javascript 1.0+JScript 1.0+
IE 3+Opera3+
Nav 2+Chrome
MozilaMini opera

image credit: http://www.dragonartz.net


Spread the love
READ  How to work with Javascipt Array

Leave a Comment

Your email address will not be published. Required fields are marked *