Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Hey folks,
For once, it's me that need a bit of enlightenment.
I want add an "keypress" event on a text input field in a Xhtml1 strict (and no, I don't want to downgrade it in "loose" doctype) page.
Xhtml specify that inline events are deprecated, so onkeypress="" is a no go.
My problem is that with ie, nothings happens...
Yes, I know that addEventHandler dont work with ie, and that the event name change.
I'm using prototype usually, but I also tried by hand, and with some obscure other js library to come to a solution, but without any success.
On Firefox, I can do what I want without any problems.
I put the keypress eventListener on the input, and the browser catch the keypress in this input.
I could not test it with safari (no mac, and safari for windows crash on submitting the request...), so if any of you can try it, it'll be greatly appreciated.
IE don't catch the event on the input element, only on the "document" element.
I didn't put the code here, as I use prototype, it will be irrelevant to simply show you the prototype instantiation.
That's a bit annoying, as it means that any keypress, even without having the focus on the input will trigger the function managing this input content.
Do any of you know how to make it work, of if even IE is capable to do that ?
I've tried googling a couple of hours, but without success.
Page here: http://seo.webalis.com
Thanks.
Tripy.
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 06-21-2007 at 11:41 AM..
|