onhelp event | help event
Occurs after the user has pressed the F1 key.
How to register:
In HTML:
In JavaScript:
<ELEMENT onhelp="handler"> |
In JavaScript:
object.onhelp = handler; | |||||||||||
object.addEventListener ("help", handler, useCapture); |
| ||||||||||
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?
|
Supported by objects:
document, window
HTML elements:
a, abbr, acronym, address, applet, area, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, html, i, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, map, marquee, menu, nobr, noframes, object, ol, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
External links:
User Contributed Comments