One of my favorite libraries to do this in a sophisticated way is Mousetrap.
It comes stocked with a variety of plugins, one of which is the record
plugin which can identify a sequence of keys pressed.
Example:
<script>
function recordSequence() {
Mousetrap.record(function(sequence) {
// sequence is an array like ['ctrl+k', 'c']
alert('You pressed: ' + sequence.join(' '));
});
}
</script>
<button onclick="recordSequence()">Record</button>