[thelist] JS: formatting onclick and onfocus

Tom Dell'Aringa pixelmech at yahoo.com
Wed Nov 12 08:05:56 CST 2003


--- Dunstan Orchard <dunstan at 1976design.com> wrote:
> Good morning!
> 
> I have another wee JS problemo: the following code works perfectly
> in Moz FB 0.6.1, but the 'onfocus' bit is not acted upon by IE or 
> Opera:

Per the W3C

"The onfocus event occurs when an element receives focus either by
the pointing device or by tabbing navigation. This attribute may be
used with the following elements: A, AREA, LABEL, INPUT, SELECT,
TEXTAREA, and BUTTON."

Notice the absence of the LI ;). Not sure why it works in Mozzy. But
probably Opera and IE followed the spec. 

Even looking in the XHTML DTD I find:

<!ELEMENT li %Flow;>
<!ATTLIST li
  %attrs;
  type        %LIStyle;      #IMPLIED
  value       %Number;       #IMPLIED
  >

And it's not listed there as a scriptable handler either. If you look
at the form:

<!ATTLIST form
  %attrs;
  action      %URI;          #REQUIRED
  method      (get|post)     "get"
  name        NMTOKEN        #IMPLIED
  enctype     %ContentType;  "application/x-www-form-urlencoded"
  onsubmit    %Script;       #IMPLIED
  onreset     %Script;       #IMPLIED
  accept      %ContentTypes; #IMPLIED
  accept-charset %Charsets;  #IMPLIED
  target      %FrameTarget;  #IMPLIED
  >

Notice is shows the scriptable events. So I think the short answer
is, its out of spec and if it works, you "just got lucky" (Dokken,
1982)

hth

Tom


=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

"I'll ho ho and ha ha you!" (Daffy Duck)


More information about the thelist mailing list