mozilla

Revision 164211 of event

  • Revision slug: Talk:Document_Object_Model_(DOM)/event
  • Revision title: event
  • Revision id: 164211
  • Created:
  • Creator: Callek
  • Is current revision? No
  • Comment

Revision Content

There needs to be a section on how HTML event attribute strings are evaluated. For ex:

<button ... onclick="foo();">

creates a function named "onclick" with the event object as a parameter named event:

function onclick(event) {
   foo();
}

See Core_JavaScript_1.5_Reference:Objects:Function#Functions_as_event_handlers.

--Maian 03:30, 8 September 2005 (PDT)

Actually, onclick="foo();" will assign the RESULT of the function "foo" to onclick, unless I am misunderstanding something. --Callek 20:20, 15 September 2005 (PDT)

Revision Source

<p>There needs to be a section on how HTML event attribute strings are evaluated. For ex:
</p>
<pre>&lt;button ... onclick="foo();"&gt;
</pre>
<p>creates a function named "onclick" with the event object as a parameter named <code>event</code>:
</p>
<pre>function onclick(event) {
   foo();
}
</pre>
<p>See <a href="en/Core_JavaScript_1.5_Reference/Objects/Function#Functions_as_event_handlers">Core_JavaScript_1.5_Reference:Objects:Function#Functions_as_event_handlers</a>.
</p><p>--<a href="User:Maian">Maian</a> 03:30, 8 September 2005 (PDT)
</p>
<dl><dd> Actually, onclick="foo();" will assign the RESULT of the function "foo" to onclick, unless I am misunderstanding something. --<a href="User:Callek">Callek</a> 20:20, 15 September 2005 (PDT)
</dd></dl>
Revert to this revision