AJAX - The Complete Reference

(avery) #1

374 Part II: Developing an Ajax Library^


<li id="item2" class="draggable">Item #2</li>
<li id="item3" class="draggable">Item #3</li>
<li id="item4" class="draggable">Item #4</li>
<li id="item5" class="draggable">Item #5</li>
</ol>

a function is bound to the mousedown event for each item in the list to begin the drag-and-
drop action as defined by function dragDropStart() using the class name idea from
before.

window.onload = function ()
{
var items = AjaxTCR.util.DOM.getElementsByClassName("draggable");
for (var i=0;i<items.length;i++)
items[i].onmousedown = function(e){dragDropStart(e, this);};
};

FIGURE 8-10 Drop zone to trigger activities
Free download pdf