Disable the back button on a browser
<script language="javascript" type="text/javascript">
function noBack()
{
window.history.forward()
}
noBack();
window.inhibited_load=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack()}
window.inhibited_unload=function(){void(0)}
</script>
Disable the Right Click of Mouse
<script LANGUAGE="JavaScript">
<!--
function click()
{
if (event.button==2)
{
alert('You Can NOT use the Right Mouse Button . No Sorry , It is my manager's spec!');
}
}
document.onmousedown=click
// -->
</script>
More will added in the next few days....
Programming help in Java , JavaScript, .Net, PHP, webservices , XML, Jquery etc.,
Showing posts with label Event Handling. Show all posts
Showing posts with label Event Handling. Show all posts
Thursday, January 13, 2011
Tutorial : Event Handling in Javascript ( 1 of 3)
In this Tutorial Series - we will try to cover the basics of event handling, advanced eventhandling, and lots of examples
Events
Events allow you to write JavaScript code that reacts to certain situations. Examples of events include:
Lets move on to using event handlers
Events
Events allow you to write JavaScript code that reacts to certain situations. Examples of events include:
The user clicking the mouse button
The Web page loading
A form field being changed
Event Handlers
The Web page loading
A form field being changed
Event Handlers
To allow you to run your bits of code when these events occur, JavaScript provides us with event handlers. All the event handlers in JavaScript start with the word
on, and each event handler deals with a certain type of event. Here's a list of all the event handlers in JavaScript, along with the objects they apply to and the events that trigger them:Event handler | Applies to: | Triggered when: |
onAbort | Image | The loading of the image is cancelled. |
onBlur | Button, Checkbox,FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, TextArea, Window | The object in question loses focus (e.g. by clicking outside it or pressing theTAB key). |
onChange | FileUpload, Select, Text, TextArea | The data in the form element is changed by the user. |
onClick | Button, Document, Checkbox, Link, Radio, Reset, Submit | The object is clicked on. |
onDblClick | Document, Link | The object is double-clicked on. |
onDragDrop | Window | An icon is dragged and dropped into the browser. |
onError | Image, Window | A JavaScript error occurs. |
onFocus | Button, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select, Submit, Text, TextArea, Window | The object in question gains focus (e.g. by clicking on it or pressing the TAB key). |
onKeyDown | Document, Image, Link, TextArea | The user presses a key. |
onKeyPress | Document, Image, Link, TextArea | The user presses or holds down a key. |
onKeyUp | Document, Image, Link, TextArea | The user releases a key. |
onLoad | Image, Window | The whole page has finished loading. |
onMouseDown | Button, Document, Link | The user presses a mouse button. |
onMouseMove | None | The user moves the mouse. |
onMouseOut | Image, Link | The user moves the mouse away from the object. |
onMouseOver | Image, Link | The user moves the mouse over the object. |
onMouseUp | Button, Document, Link | The user releases a mouse button. |
onMove | Window | The user moves the browser window or frame. |
onReset | Form | The user clicks the form's Reset button. |
onResize | Window | The user resizes the browser window or frame. |
onSelect | Text, Textarea | The user selects text within the field. |
onSubmit | Form | The user clicks the form's Submit button. |
onUnload | Window | The user leaves the page. |
Using the Event Handlers
Lets move on to using event handlers
Subscribe to:
Posts (Atom)