Cómo agregar accesos directos (keyboard shortcuts) a un sitio web
Posted on | Mayo 3, 2007
The following javascript code will allow you to add keyboard shortcuts to any webpage.
The code
(put this on any page where you want keyboard shortcuts)
<html>
<head>
<script type="text/javascript" language="JavaScript" src="shortcut.js"></script>
</head>
<body onkeydown='keyShortcut()'>
</html>
(put this in a file called shortcut.js and upload to the same directory as the webpage with the above code). This example will display an alert message when the escape key is pressed.
function keyShortcut() { var e = window.event; var code = e.keyCode; if (code == 112) { //checks for the escape key alert('escape key pressed'); }}
Vía: Justin Silverton http://www.whenpenguinsattack.com/
Comments
Leave a Reply
