[PLUG] Javascript, Firefox, IE event handling

Keith Lofstrom keithl at kl-ic.com
Wed Jul 15 04:02:02 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
------

You can see more by going to:
   http://server-sky.com/slides/plug_general_2009_07_02/
... and doing a control-U to show the page source.  

What I've seen so far says that MSIE's JScript and JavaScript have
differences in their event handling from Netscape/Mozilla/Firefox. 
And by sensing the browser, you can extract the event in the two
different ways. 

I imagine I can spend three hours looking around for, and implementing,
the best way to do this.  OTOH, perhaps somebody here already is
depressingly familiar with this problem and can provide clues.  
Either on the list, or come to Advanced Topics tomorrow night, and
you can help Eric Wilhelm and I improve the Javascript code in
our template files.

And if somebody brings a Windoze/Explorer laptop, and someone else
brings a OS-X/Safari laptop, we can try this stuff out on all the
different machines.  I will bring my two remote presenter clickers,
and we can pull codes off them and do neat things with them.

Keith

( My javascript code was copied and slightly modified from Eric Wilhelm's
Text::Slidez, btw.  Plagarize!  Let no one else's work evade your eyes! )

-- 
Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs



More information about the PLUG mailing list