SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : Dynamic HTML :

Previous DiscussionNext Discussion
 Obsessive/Compulsive re: Events

Friends,

I fear I'm losing site of the forest, but...in a project, I've created
three functions to handle events:

addListeners()
addEvent(element, eventType, functionName)
eventHandler(e)

and an XML file to store event info for the elements:

<root>
 <element id='txt09'>
  <event name='blur' />
  <event name='focus' />
  <event name='keydown' />
 </element>
 <element id='txt10'>
  <event name='blur' />
  <event name='focus' />
  <event name='keydown' />
 </element>
 <element id='txt11'>
  <event name='blur' />
  <event name='focus' />
  <event name='keydown' />
 </element>
 <element id='spanAllItem'>
  <event name='dblclick' />
 </element>
 <element id='spanDocItem'>
  <event name='dblclick' />
 </element>
 <element id='thDocItem'>
  <event name='click' />
  <event name='mouseover' />
  <event name='mouseout' />
 </element>
</root>

addListeners loads the XML file, parses it, and calls addEvent to assign
the event to the element(s) found within.

eventHandler is invoked when any of the elements fire an event; it decodes
the element and through switch() blocks determines what to do.

Am I taking things too far, when I could just as well code 'onClick()',
'onBlur()', etc. directly into the HTML element declarations?

Or does abstracting things in this way make sense?

tia

INVALID ARGUMENT***