![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.javascript archiveRe: Why 'event' is not defined in Mozilla
From: Michael Winter <m.winter@blueyonder.co.uk>
Date: Fri Nov 25 2005 - 16:35:48 CET
On 25/11/2005 13:55, prabhdeep@gmail.com wrote:
> Can somebody explain, why in following code, i get "event not defined"
Thomas commented on many problems, though omitted the cause of this
[snip]
> doument.getElementById('id1').addEventListener('mousedown', function(){
The W3C event model, as implemented by Mozilla and others (excluding
var element;
if(document.getElementById
Notice the addition of an argument in the function expression.
Presumably, click is a user-defined function.
> But at the same time code as following works just fine
[snip]
> onkeypress="return isNumberInput(this, event);" />
When a browser encounters intrinsic event attributes, the value of that
In IE, this transformation is similar to:
element.onkeypress = function() {
As it defines a global event object, the 'event' identifier will resolve
In browsers that implement the W3C event model, the transformation is
element.onkeypress = function(event) {
In this way, the two models are markedly different, but interoperable
Mike
-- Michael Winter Prefix subject with [News] before replying by e-mail.Received on Sat Dec 3 04:30:12 2005 |