Thursday, March 22, 2012

Java Script Events and there Descriptions

EventDescriptionApplicable on Controls
onAbortWhen user cancel image loadingImage
onBlurWhen control lost its FocusButton, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, TextArea, Window
onChangeCombo index change/Textbox data changeText, TextArea, Select
onClickMost useful event. Occur when user click on a buttonButton, Checkbox, Link, Radio, Submit
onDblClickWhen user double click on a LinkLink
onFocusWhen an object get focusButton, Checkbox, Radio, Reset, Select, Submit, Text, TextArea
onKeyDownWhen the key is down means pressing timeLink, TextArea
onKeyPressWhen user presses/holds a keyLink, TextArea
onKeyUpWhen user release a keyLink, TextArea
onLoadAfter completion of loading a pageWindow, Image
onMouseDownWhen mouse pressesLink, Button, Document
onMouseMoveWhen user moves the mouseLink, Button, Document
onMouseOutWhen user moves the mouse away from a objectImage, Link
onMouseOverWhen user moves the mouse over a objectImage, Link
onMouseUpWhen user release mouseDocument, Button, Link
onMoveWhen user moves the browser window or a frameDocument, Button, Link
onResetBy clicking on reset ButtonForm
onResizeWhen user resizes the browser window or a frameWindow
onSelectWhen user select textText, TextArea
onSubmitWhen user clicks the submit buttonForm
onUnloadWhen user leaves the page/close the browserWindow


Example onClick Event:


function clck()
{
// Code goes here
alert("Click event fired");
// Return false never make a post back to server.
// so one can add validation by using this concept. If return true then the page will be post back to server
return false;
}

Add the handler:
<asp:button runat="server" id="cmdOnClick" text="OnClientClick" onclientclick="return clck();">
<asp:button runat="server" id="cmdOnClick" text="OnClientClick" onclientclick="return clck();">
<input type="button" name="cmdHTML" value="HTML onClick" onclick="return clck();">

No comments:

Post a Comment