Try this one. Kudos to SeAL for the original script.
Additionaly, the numeric values for 0-9 are 48-57, respectivly.
<script language="JavaScript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function keyDown(e) {
if (ns4) {
if (e.which == "#"

{
alert("your img switch code here"

;
}
}
if (ie4) {
if (event.keyCode == "#"

{
alert("your img switch code here"

;
}
}
}
document.onkeydown = keyDown
if (ns4) document.captureEvents(Event.KEYDOWN)
//-->
</SCRIPT>