The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

event in Mozilla

I've writtena script that traps for characters I don't want a user to be able to enter into a form. It works fine in Internet Explorer but Mozilla throws up an error about "event is not defined". Any ideas how to get round this ?

I found that for Moz/Fb keyCode is valid - but if it is zero then you have to use which. For some previous versions of Moz this was not true - you always used which. They like to keep us on our toes

(btw, the function xDef just returns true if all its arguments are 'defined')

Obviously I need to do more testing on this but... it's discouraging because browser object models change so often (and sometimes drastically) between each version release. And of course these kinds of changes aren't documented very well, if at all.

Thanks for the excellent responses. It is really useful when not only do you solve the problem but explain what is going on. I have modified the code and it works like a charm. Rated you both accordingly