Pages

Thursday, August 4, 2011

CRM 2011 Double Click Event

In a former post I provided a function for adding "onclick" events using jscript. You may however ask: "What about double click events?". Well if you did, the answer is a slight variation of the function provided for the "onclick" event. That is:


function RegisterOnDoubleClickEvent(attr, fn) {
    var e = document.getElementById(attr);
    var f = "var doubleclick=function() { " +
              fn + "(); " +
                  " };";

    eval(f);

    // Attach to double click event 
    e.attachEvent("ondblclick", doubleclick, false);
}


Thereafter all you need to do to register an OnDoubleClick event is to pass the following function call:



RegisterOnDoubleClickEvent("attribname", "functionname");

No comments:

Post a Comment