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>
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum