[PLUG] Javascript, Firefox, IE event handling

Joe Pruett joey at clean.q7.com
Wed Jul 15 04:19:07 UTC 2009


> OK, so the template file I use for WYDIWYS has a problem.
> It pulls event keyCodes with firefox, not with Safari or IE.
> I can still navigate with a mouse, I just can't use my clicker.
>
> Here is a bit of the Javascript code:
>
> ------
> document.onkeypress=function(e) {
>   var e=window.event || e
>   var num=e.keyCode  || e.which;
>   switch (num) {
>      // keyboard
>      case 36: window.location = first;   break;  // home          key
>      case 35: window.location = last;    break;  // end           key
> ------

probably your best bet is to use something like jquery which handles 
browser differences for you.



More information about the PLUG mailing list