DHTML: Add event dispatcher to HTML form field

Sure you can use this function with any DOM object. Not only a form field.

/* event dispatcher */
function installAC(frm, fld) {
a = document.forms[frm].elements[fld];
if (a.addEventListener) {a.addEventListener("keyup", PerformActions, false)} // firefox
else if (a.attachEvent) {a.attachEvent("onpropertychange", PerformActions)} // ie

/* actions to do */
function PerformActions(h) {
// your code here


Popular posts from this blog

Data visualization for Roadmap Microsite (Angular and D3.js)

Axure RP: Image over button - Where do I put the interaction?

Using Trello and Confluence to manage UX design project. Part 1