Welcome to Virtual Tutorial World Guest!




Home Hot Key in Javascript

 
Post new topic   Reply to topic    VTW Forum Index -> Javascript
View previous topic :: View next topic  
Author Message
computergeek67
Administrator
Administrator


Joined: 31 Jul 2007
Posts: 144
Tokens: 147
Location: US

PostPosted: Sun Oct 21, 2007 1:11 am    Post subject: Home Hot Key in Javascript Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    VTW Forum Index -> Javascript All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Virtual Tutorial World ©2007-2008 computergeek67

Affiliates