cz231
10-10-2006, 10:11 PM
1) Script Title: Home HOt Key Script
2) Script URL (on DD):http://www.dynamicdrive.com/dynamicindex5/button1.htm
3) Describe problem: I'm trying to put this in my page so when users click on the letter h they go back to the homepage of the site. When I put it into the <head> of my page and then preview the page in my browser (tried IE7 and FF) it doesn't work. I tried using it with the original site (dynamicdrive.com) and it worked fined. But when I put my site in it doesn't do anything. I used the wizard it provided and the code var hotkey= was blank as compared to 104 which came after the first time. I don't know if this would help or not. Any tips on how to get it to work with other sites would be very appreciated.
Code First Time
<script language="JavaScript1.2">
/*
Home Hot Key Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
var hotkey=104
var destination="http://www.dynamicdrive.com"
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
</script>
Code Second Time
<script language="JavaScript1.2">
/*
Home Hot Key Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
var hotkey=
var destination="http://www.dynamicdrive.com"
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
</script>
I replaced the var destination with my site's URL
Thanks once again
2) Script URL (on DD):http://www.dynamicdrive.com/dynamicindex5/button1.htm
3) Describe problem: I'm trying to put this in my page so when users click on the letter h they go back to the homepage of the site. When I put it into the <head> of my page and then preview the page in my browser (tried IE7 and FF) it doesn't work. I tried using it with the original site (dynamicdrive.com) and it worked fined. But when I put my site in it doesn't do anything. I used the wizard it provided and the code var hotkey= was blank as compared to 104 which came after the first time. I don't know if this would help or not. Any tips on how to get it to work with other sites would be very appreciated.
Code First Time
<script language="JavaScript1.2">
/*
Home Hot Key Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
var hotkey=104
var destination="http://www.dynamicdrive.com"
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
</script>
Code Second Time
<script language="JavaScript1.2">
/*
Home Hot Key Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
var hotkey=
var destination="http://www.dynamicdrive.com"
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
</script>
I replaced the var destination with my site's URL
Thanks once again