Код: Выделить всё
var fileInput = document.createElement("input")
fileInput.type = "file"
function load() {
alert("loaded: " + fileInput.files.length)
}
function onkey(ev) {
if (ev.keyCode == 79 /*KEY O*/ && ev.ctrlKey) {
fileInput.click()
ev.preventDefault()
return false
}
}
fileInput.addEventListener("change", (function(ipt) {
return function() {
load();
ipt.value = null;
}
})(fileInput))
window.addEventListener("keydown", onkey)
Подробнее здесь: https://stackoverflow.com/questions/344 ... boardevent