Mega Code Archive

 
Categories / JavaScript Tutorial / Document
 

Document captureEvents()

Syntax document.captureEvents(eventMask) The captureEvents() method specifies the type of events that should be passed to the document rather than to the object for which they were intended. The eventMask argument(s) specifies what events to capture. The following list shows all the possible event masks. Multiple events can be captured by using the bitwise OR (|) operator. Event.ABORT Event.BLUR Event.CHANGE Event.CLICK Event.DBCLICK Event.DRAGDROP Event.ERROR Event.FOCUS Event.KEYDOWN Event.KEYPRESS Event.KEYUP Event.LOAD Event.MOUSEDOWN Event.MOUSEMOVE Event.MOUSEOUT Event.MOUSEOVER Event.MOUSEUP Event.MOVE Event.RESET Event.RESIZE Event.SELECT Event.SUBMIT Event.UNLOAD <html>     <form>     <input type="button"            value="Yellow/Purple"            onMouseDown="document.bgColor='yellow'"            onMouseUp="document.bgColor='purple'">     </form>     <script>     <!--     document.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);     document.onmousedown = function(event){document.bgColor='red'};     document.onmouseup = function(event){document.bgColor='blue'};     -->     </script>     </html>