Associating a hot key with a button in a web page

I’m trying to add shortcut keys to a web page. (I use PHP on localhost to serve this page so I control it.)

Suppose I want to have Ctrl+A click the “Select All” button on the page. How would I do that in the page’s javascript?

(I have javascript skills and this page is laid out using Dojo.)

Take a look at the Mousetrap library. It makes that sort of thing pretty straight forward from what I recall.

Thanks. In the end I created an event listener for the “keypress” event - using addEventListener() and decoded the event object passed to the handler.

It was easier than I thought. The event object had a property that told me whether Ctrl had been pressed, together with eg ‘a’.