Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
You are here: Reference > JavaScript > client-side > event handling > events > onhelp

onhelp event | help event

Browser support:
Occurs after the user has pressed the F1 key.

How to register:

In HTML:
<ELEMENT onhelp="handler">

In JavaScript:
object.onhelp = handler;
object.addEventListener ("help", handler, useCapture);
9
object.attachEvent ("onhelp", handler);
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript.

Basic information:

Bubbles Yes
Cancelable Yes
Event object Event

Actions that invoke the onhelp event:

  • Pressing the F1 key when the document has the focus.

Actions that do not invoke the onhelp event:

  • Pressing the F1 key and when document has no focus.
  • Selecting the 'Contents and Index' menu item from the Help menu.

Example HTML code 1:

This example illustrates the use of the onhelp event:
<head>
    <script type="text/javascript">

        if ('onhelp' in window) {   // Internet Explorer
            window.onhelp = OnHelp;
        }
        else {  // Firefox, Opera, Google Chrome and Safari
            window.onkeydown = OnKeyDown;
        }
        

        function OnKeyDown (event) {
            if (event.keyCode == 112 /*KeyboardEvent.DOM_VK_F1*/) {
                OnHelp ();
            }
        }

        function OnHelp () {
            alert ('The F1 key has been pressed.');
        }
    </script>
</head>
<body>
    Press the F1 key!
</body>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content