window.captureEvents() : Window Object : Window JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Window » Window Object »

 

window.captureEvents()













Syntax








window.captureEvents(event)
    window.captureEvents(event1 | event2 | eventN)



The captureEvents() method captures all the events of the event type passed.

If you have multiple events to capture, separate them with the pipe, |, character.

The types of events that can be captured are as follows:


  1. Event.ABORT

  2. Event.BLUR

  3. Event.CHANGE

  4. Event.CLICK

  5. Event.DBLCLICK

  6. Event.DRAGDROP

  7. Event.ERROR

  8. Event.FOCUS

  9. Event.KEYDOWN

  10. Event.KEYPRESS

  11. Event.KEYUP

  12. Event.LOAD

  13. Event.MOUSEDOWN

  14. Event.MOUSEMOVE

  15. Event.MOUSEOUT

  16. Event.MOUSEOVER

  17. Event.MOUSEUP

  18. Event.MOVE

  19. Event.RESET

  20. Event.RESIZE

  21. Event.SELECT

  22. Event.SUBMIT

  23. Event.UNLOAD

After an event has been captured, you can define a function to replace the built-in method for handling the event.












<html>
    <head>
    <title>Using window.captureEvents</title>
    <script language="JavaScript1.2">
    <!--
    var counter = 0;
    window.captureEvents(Event.CLICK)
    window.onclick = myClickHandler;
    
    function myClickHandler(){
      window.document.myForm.myText.handleEvent;
    }
    
    function changeText(){
      document.myForm.myText.value = counter++;
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
      <input type=TEXT size=value="" name="myText" onClick='changeText()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Window
» Window Object