yzzzzz wrote:
> Scripsit "yzzzzz":
>
> > Scripsit "yzzzzz":
> >
> >> Hi
> >>
> >> I have:
> >> <div onkeypress="go(event)">...</div>
> >> and:
> >>
> >> function go(event) {
> >> alert(event.keyCode);
> >> }
> >>
> >> but I always get 0 for the keycode.
> >>
> >> I am using Mozilla.
> >> Thank you for your help.
> >>
> > By the way, it works in IE. Is the property different in Mozilla/Netscape?
>
> Ok
>
> It's not *keyCode* it's *charCode*.
> Now *that's* incompatibility.
The way events are handled and the properties they have are different between IE
and Mozilla.
IE has a global Event object attached to the default window object
(window.event). In Mozilla, the event is passed as the first parameter to the
event handler.
A list of event object properties in IE is available at: <url:
http://msdn.microsoft.com/workshop/a.../obj_event.asp
/>
A list of event object properties in Mozilla is available at:
<url:
http://www.mozilla.org/docs/dom/domr...ef.html#999092 />
--
| Grant Wagner <>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html