...and as for the problem you're having. Yep, 'tis a very annoying problem.
Can you clarify, though, when the keycode is different? Is it always
different, or only for capital letters? Because my problem with this was
related to getting the same keycode for a letter, regardless of typing a
capital letter or not. They want you to check the modifiers to see if the
shift key was also depressed and deduce on your own whether or not it should
be capital (which of course doesn't take in to account whether or not the
capslock key is on). Anyway... the answer, unfortunately, is to not use
Event.observe, but attach the handler directly like this (thus bypass the
new W3C event model)...

field.onkeypress = maskKeyPress;

The above is the same result as attaching the handler inline.

This is certainly not an ideal thing to do, but, it does work.

On 6/7/07, RobG <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Jun 7, 8:05 pm, John <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I have a problem with the Event.observe method on IE.
> > When I use The Event.observe method, the key code that I retrieve from
> > the event,
> > is different if I use an inline function.
> >
> > Here is the html code to test it (You must have prototype.js on the
> > same directory)
>
> Dunno about the IE issue since I don't have it available right now,
> however...
>
> [...]
> >                         //browser detection
> >
> >                         function maskKeyPress(objEvent) {
> >                                 var iKeyCode, strKey;
> >
> >                                 var strUserAgent =
> navigator.userAgent.toLowerCase();
> >                                 var isIE = strUserAgent.indexOf("msie")
> > -1;
> >                                 if (isIE) {
> >                                     iKeyCode = objEvent.keyCode;
> >                                 } else {
> >                                     iKeyCode = objEvent.which;
> >                                 }
>
> Browser detection is a really bad idea, instead consider:
>
>   var iKeyCode = objEvent.keyCode || objEvent.which;
>
>
> --
> Rob
>
>
> >
>


-- 
Ryan Gahl
Principal, Manager
Nth Penguin, LLC - Consulting
http://www.nthpenguin.com
--
Software Architect
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-262-951-6727
Blog: http://www.someElement.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to