JSFiddle - React, Tailwind, and code Playground
HTML
<input type="image" src="button_start.png" onclick="start();">
<input type="image" src="button_stop.png" onclick="stop();">
<input type="image" src="button_reset.png" onclick="reset()">
JavaScript
function start(){ alert('Started...'); }
function stop(){ alert('Stoped...'); }
function reset(){ alert('Reseted...'); }
window.addEventListener('load', function(e){
var keys = { 't' : 'start', 's' : 'stop', 'r' : 'reset' };
window.addEventListener('keypress', function (e){
var fn = String.fromCharCode(e.which||e.keyCode);
if(fn in keys) window[keys[fn]]();
});
});
/*
// Non standard but easy to use in all browsers
window.onload = function(){
var keys = { 't' : 'start', 's' : 'stop', 'r' : 'reset' };
window.onkeypress = function(e){
var fn = String.fromCharCode(e.which||e.keyCode);
if(fn in keys) window[keys[fn]]();
};
};
*/