javascript Keypress code problem


#1

I want to create a Javascript program that when I press a key it will give me a matching image. I have images named

Letter-ATumb, Letter-BThumb to Letter-ZThumb. Do I have to convert the code I get from keypress event to a letter character? Then I am lost especially if the solution is an array. Thanks for any input or thoughts out there. I may get this Javascript stuff eventually.


#2

Yup. If you’re using charCode, its not hard to do:

var letter = String.fromCharCode(event.charCode).toUpperCase();
var imageName = 'Letter-' + letter + 'Thumb';

#3

That is all. I always think it is going to very hard! Thanks! I am going to have fun with this!