Zynex
01-15-2007, 11:27 AM
I just received a great script from someone for making your own acces keys. BUT I need the visitor to press a combination of 2 keys. For instance Ctrl + Y. Does anyone know how?
here's the code
<script type="text/javascript">
keys="hyg"
dest=["http://www.htmlforums.com","http://www.yahoo.com",
"http://www.google.com"]
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function go_dest(e){
for (i = 0; i < dest.length; i++){
if (document.layers){
if (e.which==keys.charCodeAt(i))
window.location=dest[i]
}
else if (document.all){
if (event.keyCode==keys.charCodeAt(i))
window.location=dest[i]
}
else if ((document.getElementById)&&(!document.all)){
if (e==keys.charCodeAt(i))
window.location=dest[i]
}
}
}
document.onkeypress=go_dest
</script>
here's the code
<script type="text/javascript">
keys="hyg"
dest=["http://www.htmlforums.com","http://www.yahoo.com",
"http://www.google.com"]
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function go_dest(e){
for (i = 0; i < dest.length; i++){
if (document.layers){
if (e.which==keys.charCodeAt(i))
window.location=dest[i]
}
else if (document.all){
if (event.keyCode==keys.charCodeAt(i))
window.location=dest[i]
}
else if ((document.getElementById)&&(!document.all)){
if (e==keys.charCodeAt(i))
window.location=dest[i]
}
}
}
document.onkeypress=go_dest
</script>