In the example where JavaScript receives keyboard commands, press different keys on the keyboard, and the program will jump to different webpages. In this example, press the key program to jump to the homepage of the home of the script, and realize the function of clicking the button to jump. Press the key on the keyboard to go to the home page of the script house.
<SCRIPT language = "JavaScript"> <! -- Var hotkey = 97 var destination = "http://www.jb51.net" if (document. layers) document. captureEvents (Event. KEYPRESS) function backhome (e) {if (document. layers) {if (e. which = hotkey) window. location = destination} else if (document. all) {if (event. keyCode = hotkey) window. location = destination} document. onkeypress = backhome onkeydown = "javascript: onenter ();" function onenter () {if (event. keyCode = 13) {alert ("Press ENTER") ;}--> SCRIPT
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]