[thelist] JS: formatting onclick and onfocus

Joshua Olson joshua at waetech.com
Wed Nov 12 08:36:59 CST 2003


----- Original Message ----- 
From: "Tom Dell'Aringa" <pixelmech at yahoo.com>
Sent: Wednesday, November 12, 2003 9:05 AM


> Even looking in the XHTML DTD I find:
>
> <!ELEMENT li %Flow;>
> <!ATTLIST li
>   %attrs;
>   type        %LIStyle;      #IMPLIED
>   value       %Number;       #IMPLIED
>   >

Tom,

You are going down the right path, but you may want to take this a bit
farther.  Notice the reference to %attrs;?

Here's the definition of %attrs

<!ENTITY % attrs "%coreattrs; %i18n; %events;">

%attrs is defined as a union of %coreattrs; %i18n, and %events.

Here's %events

<!ENTITY % events
 "onclick     %Script;       #IMPLIED
  ondblclick  %Script;       #IMPLIED
  onmousedown %Script;       #IMPLIED
  onmouseup   %Script;       #IMPLIED
  onmouseover %Script;       #IMPLIED
  onmousemove %Script;       #IMPLIED
  onmouseout  %Script;       #IMPLIED
  onkeypress  %Script;       #IMPLIED
  onkeydown   %Script;       #IMPLIED
  onkeyup     %Script;       #IMPLIED"
  >

Therefore, most elements (including LI) define most of the scriptable
actions.

The DTD defines the following separately:

<!ENTITY % focus
 "accesskey   %Character;    #IMPLIED
  tabindex    %Number;       #IMPLIED
  onfocus     %Script;       #IMPLIED
  onblur      %Script;       #IMPLIED"
  >

onfocus and onblur are defined here and there doesn't seem to be a link into
these attributes from LI.  So, you are correct in that the DTD does not
specify onfocus as an attribute for LI in the markup, but it's important to
travel down all the paths of the DTD before coming to that conclusion.

Dunstan,

I can understand why you'd want to set the onclick handler for an LI, but
I'm not sure I understand how onfocus is applicable in any case.  Only
certain elements can be focused (links, buttons, etc) and it doesn't seem
likely that an LI logically can receive focus.

What did you have in mind when you looked at adding an onfocus handler to
the LI?

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list