Here is a rough code sample.
Whenever a user inputs a correct image name, the image will be loaded.
I hope this will help.
var target = "badger";
var inputs = [];
document.onkeydown = function (e){
e = e || window.event; // for InternetExplorer
inputs.push(String.fromCharCode(e.keyCode));
var testStr = inputs.join("");
if (target.substr(0,inputs.length).toUpperCase() !== testStr){
inputs = [];
return;
}
if(testStr.length === target.length){
//console.log("you inputed image name!");
img=loadImage (target + ".jpg");
image(img,0,200);
}
};