computergeek67 Administrator


Joined: 31 Jul 2007 Posts: 144 Tokens: 147 Location: US
|
Posted: Sun Oct 21, 2007 1:11 am Post subject: Home Hot Key in Javascript |
|
|
This is a script that jumps back "home" when "h" is pressed. In other words, a script that allows you to specify a target url to go to when "h" is pressed.
Press "h" (or "H") to go home.
Simply copy the below into the <head> section of your page. Be sure to change var targeturl to your own.
| Code: | <script language="JavaScript1.2">
<!--
/*
By 11amDesign (www.11amdesign.com)
*/
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
var targeturl="http://www.11amdesign.com"
if (document.layers||document.getElementById&&!document.all){
if (e.which==104||e.which==72)
window.location=targeturl
}
else if (document.all){
if (event.keyCode==104||event.keyCode==72)
window.location=targeturl
}
}
document.onkeypress=backhome
//-->
</script> |
_________________
Come to me if you have any questions  |
|