[thelist] Re: JS: formatting onclick and onfocus

Dunstan Orchard dunstan at 1976design.com
Wed Nov 12 13:32:50 CST 2003


Hey Tom, Joshua, thanks for the help,

> Joshua Olson <joshua at waetech.com> wrote:
> 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?

Well, first off, I wanted the onfocus even to run if people clicked on a
relative link from another comment. Clicking on a 'view this related comment'
link takes you (unsuprisingly) to the <li> that contains that comment. It's the
<li>s that have the IDs, and so it's them that gain focus when these relative,
inter-comment links are clicked.

The other occasion when I want the onfocus to run is when links are tabbed
through. I was thinking that the <li> is a container for a comment, and each
comment contains links. If any of these links received focus (through tabbing)
then (in essence) the <li> is also receiving focus, the onfocus event would
trigger and the <li> would display the 'I'm in focus' behaviour.

Is that enough info?

Cheers - Dunstan

p.s. is this anything to do with event bubbling?
http://www.quirksmode.org/js/events_order.html

---------------------------
Dorset, England
http://www.1976design.com/
http://www.1976design.com/blog/


More information about the thelist mailing list