views:

137

answers:

1

All I need is to be able to click a button and have it do the KeyDown event for Enter, I've tired doing KeyDownCheck(13); and similar things, and I can get into the KeyDown event, but I can't get it to recognize that I want Enter, and it doesn't go to any specific key.

All Enter does is call another function, but when I try to call the function from a button it seems to call a different function which puts me back. Ironically, I had the same problem in the Enter event, but I fixed it with a return false; statement and I don't know how to do that for a button, so I was just going to call the KeyDown.

Is there a specific way to put this in? Thanks in advance

A: 

Notice, that key events are heavily browser specific. It is no fun at all really especially with none alphanumeric keys like 'enter'. See here for a full run-down on all the issues. See here for a test script, that helps you to determine the results your browser gives you.

haffax
I've already gone through a month of making the KeyDown work the same in all the different browsers and OSs. I think, the KeyDown should work fine. I just need to call it somehow.
Doug
Best show some code of what you are doing. Your description is very confusing. Also your proposed solution to your problem seems a bit complicated. I don't see why another function is called in the click event of your button. Do you mean afterwards the button does something else too? In that case try to call both stopPropagation and preventDefault on the event after you handled it.I don't believe there is a cross-browser way to initiate keyboard events programatically using javascript.
haffax