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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---