View Full Version : fire Keyboard event after clicking on image

08-11-2008, 12:50 PM
This particular scenario is for FF and Safari only

On my page I have a div tag [id = DivViewer] and inside the div tag I have a image [ id = viewerImg ].

I have hooked the keyboard events like this through Javascript :

document.onkeydown = processKeyBoardEvents;

function processKeyBoardEvents(e)
{ //do somehting


So If I click somewhere on the div apart from the image, then i press keyboard keys method "processKeyBoardEvents" gets fired, but if i only click on the image , and then i press keyboard keys "processKeyBoardEvents" doesn't get fired.

I have tried things like scrollviewstate() etc.. but doesn't seem to work.