Hello
I am trying to implement a hotkey on a web site. I can intercept a hotkey combination but I cannot get to implement a function other than alert.
The code I am using is
script type='text/javascript' language='javascript'>
document.onkeyup = function(e)
{
if (e.ctrlKey && e.altKey && e.which == 89)
{
alert("Ctrl + Alt + Y shortcut key combination was pressed");
alert('aboutBox()');
alert("Ctrl + Alt + Y shortcut key combination was pressed");
}
}
</script>
I am trying to get it to implement the about function but it will not. I know I am missing something but I do not know what or why. I would appreciate any pointers or help.
Firstly, you no longer need type='text/javascript', it’s default in HTML5; and we haven’t had to use language='javascript' for quite some time, so you can remove both attributes.
Is the function aboutBox() being defined prior to your document.onkeyup?
Thank you! Your comment regarding the aboutBox() function was spot on. I feel so silly but it happens from time to time. I was so busy trying to the hotkey code to work I forgot to include the function in the header file. I really appreciate the second set of eyes.
Regarding the attributes, yes. I just include them out of habit.