Key Class Question

I have an idea for a website that i am working on.

I want to have all the keys on the keyboard, when pressed, display an set of random images. For instance if you press ‘a’ on the keyboard i want it to loop threw say 5 different images of the lowercase ‘a’. And when you press ‘A’ the same thing but with Capital A’s

Is this possible to do capital and lowercase. If not can someone help me with the first part?