How can I add a JavaScript keyboard shortcut to an existing JavaScript Function?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-24T21:02:57Z Indexed on 2010/03/24 21:23 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

Here is my code:

function pauseSound() {
    var pauseSound=document.getElementById("backgroundMusic");
    pauseSound.pause(); 
}

I would like to add a keyboard shortcut to this code, how can I do this so that the function can also be executed when a button is clicked too?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about script