Event : Event Object « Event « JavaScript Tutorial

JavaScript Tutorial
1. Language Basics
2. Operators
3. Statement
4. Development
5. Number Data Type
6. String
7. Function
8. Global
9. Math
10. Form
11. Array
12. Date
13. Dialogs
14. Document
15. Event
16. Location
17. Navigator
18. Screen
19. Window
20. History
21. HTML Tags
22. Style
23. DOM Node
24. Drag Drop
25. Object Oriented
26. Regular Expressions
27. XML
28. GUI Components
29. Dojo toolkit
30. jQuery
31. Animation
32. MS JScript
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript Tutorial » Event » Event Object 
15. 1. 1. Event

The Event object represents an event.

Properties of the Event Object is listed in the following table.

PropertyDescription
dataArray of URL's for dragged and dropped objects
heightHeight of window
layerXHorizontal cursor position within layer
layerYVertical cursor position within layer
modifiersBit mask representing modifier keys
pageXHorizontal cursor position within Web page
pageYVertical cursor position within Web page
screenXHorizontal cursor position within computer screen
screenYVertical cursor position within computer screen
targetObject for captured events
typeType of event
whichThe mouse button that is pressed
widthWidth of window


In addition to the Event properties, events exist that get handled.

The available events are shown in the following Table.

EventsDescription
ABORTLoading of Web page interrupted by user.
BLURFocus is removed from the object.
CHANGEContents or setting for document object changed.
CLICKMouse button is clicked once.
DBLCLICKMouse button is clicked twice.
DRAGDROPObject is dragged and dropped.
ERRORError occurred during loading.
FOCUSFocus is applied to an object.
KEYDOWNA key is pressed down.
KEYPRESSA key is pressed.
KEYUPA key is let up after being pressed down.
LOADLoad document within a browser.
MOUSEDOWNThe mouse button is pressed down.
MOUSEMOVEThe mouse cursor is moved.
MOUSEOUTThe mouse cursor is moved away from a specific object.
MOUSEOVERThe mouse cursor is moved over a specific object.
MOUSEUPThe pressed mouse button is let up.
MOVEObject is moved on the screen.
RESETReset button is pressed.
RESIZEWindow or frame has been resized.
SELECTDocument object is selected.
SUBMITSubmit button is pressed.
UNLOADDocument is unloaded from browser.


<html>
    <head>
    <title>Using the event object</title>
    </head>
    <body>
    <script language = "Javascript">
    <!--

    window.captureEvents(Event.KEYPRESS | Event.DBLCLICK);

    document.captureEvents(Event.SUBMIT);

    function handlePress(evnt){
       alert("You pressed a key down. The event type: " + evnt.type);
       return true;
    }

    function handleDblClick(evnt){
       alert("You double clicked at location: " + evnt.pageX + "," + evnt.pageY);
       return(true);
    }
    function handleSubmit(evnt){
       alert("You clicked on the submit button");
    }
    window.onkeypress = handlePress;

    window.ondblclick = handleDblClick;

    document.onsubmit = handleSubmit;
    -->

    </script>
    When you click on the submit button, it triggers the <b>SUBMIT</b>
    event which displays an alert box.

    <br><br>
    If you double click somewhere in the page, it triggers the
    <b>DBLCLICK</b> event.
    <br><br>
    When a key is pressed down in the browser, the <b>KEYPRESS</b>
    event is triggered.
    <br><br><br>
    <form>
    <input type="submit" value="Submit" onSubmit=''>
    </form>
    </body>
    </html>
15. 1. Event Object
15. 1. 1. Event
15. 1. 2. event.data
15. 1. 3. event.height
15. 1. 4. event.layerX
15. 1. 5. event.layerY
15. 1. 6. event.pageX
15. 1. 7. event.pageY
15. 1. 8. event.screenX
15. 1. 9. event.screenY
15. 1. 10. event.target
15. 1. 11. event.type
15. 1. 12. event.which
15. 1. 13. event.width
15. 1. 14. Event.ABORT
15. 1. 15. Event.CHANGE
15. 1. 16. Add event handler to form
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.