The script generator runs on the script, hotkey.js. Here is an updated version:
And on the page where this generator is run advise the users to insert this event handler in their body tag:Code:var thecode='' function step1(){ document.final1.final2.value='Generating code...please stand by' setTimeout("step2()",1000) } function step2(){ document.final1.final2.value='<script language="JavaScript1.2">\n\n' document.final1.final2.value+='\/*\nHome Hot Key Script- \nŠ Dynamic Drive (www.dynamicdrive.com)\nFor full source code, installation instructions,\n100\'s more DHTML scripts, and Terms Of\nUse, visit dynamicdrive.com\n*\/\n\n' document.final1.final2.value+='var hotkey='+thecode+'\nvar destination="http://www.dynamicdrive.com"\nif (document.layers)\ndocument.captureEvents(Event.KEYPRESS)\nfunction backhome(e){\nif (document.layers){\nif (e.which==hotkey)\nwindow.location=destination\n}\nelse if (document.all){\nif (event.keyCode==hotkey)\nwindow.location=destination\n}\nelse if((!document.all)&&(document.getElementById)){\nif (e==hotkey)\nwindow.location=destination\n}\n}\ndocument.onkeypress=backhome\n\n<\/script>' } function generatecode(){ if (document.key1.key2.value.length==1){ if ((document.layers)||((!document.all)&&(document.getElementById))) thecode=document.key1.key2.value.charCodeAt(0) step1() } else alert("Please enter only one key!") } function generatecode2(){ if (document.all) thecode=event.keyCode event.cancelBubble=true } if (document.all) document.key1.key2.onkeypress=generatecode2
HTML Code:<body onkeypress="if ((document.getElementById)&&(!document.all)){backhome(event.which)}">



Reply With Quote
Bookmarks