343Chapter 15Generic HTML Element Objectsdocument.getElementById( legend ).style.visibility = hidden ; } (Web and email hosting)

343Chapter 15Generic HTML Element Objectsdocument.getElementById( legend ).style.visibility = hidden ; } function init() { var msg = ; if (navigator.userAgent.indexOf( Mac ) != -1) { msg = Press help key for help. ; } else if (navigator.userAgent.indexOf( Win ) != -1) { msg = Press F1 for help. ; } document.getElementById( legend ).style.visibility = hidden ; document.getElementById( legend ).innerHTML = msg; }

onhelp Event Handler



Name:
Year of Birth:

Related Items:window.showHelp(), window.showModalDialog()methods. onkeydownonkeypressonkeyupCompatibility:WinIE4+, MacIE4+, NN4+, Moz1+, Safari1+ When someone presses and releases a keyboard key, a sequence of three events fires in quicksuccession. The onkeydownevent fires when the key makes its first contact. This is followedimmediately by the onkeypressevent. When contact is broken by the key release, the onkeyupevent fires. If you hold a character key down until it begins auto-repeating, the onkeydownandonkeypressevents fire with each repetition of the character. The sequence of events can be crucial in some keyboard event handling. Consider the sce- nario that wants the focus of a series of text fields to advance automatically after the userenters a fixed number of characters (for example, date, month, and two-digit year). By thetime the onkeyupevent fires, the character associated with the key press action is alreadyadded to the field and you can accurately determine the length of text in the field, as shownin this simple example: