I found some interesting code when I was looking at things that people had added on to Scriptaculous, and I'm trying to modify it for my purposes. I got nearly all of it working, except when I paste in the drop handler code, my page stops loading.
Here's the relevant snipits:
For draggables:
for (i=0; i<=50; i++){
Squad = 'Squad' + i
if($(Squad)){
new Draggable(Squad,{revert:true});
For Droppables:
Droppables.add('ToEast', {
accept: ["Nurse","Squad","Doctor"],
onDrop:function(e){DropHandler(e,'ToEast')}
});
The drophandler:
function DropHandler(element,el){
var newnode = document.createElement('img');
var classname = element.className;
newnode.src="images/"+IdCatcher+".jpg";
newnode.id = IdCatcher;
$(el).appendChild(newnode);
newnode.setAttribute("class", 'classname');
newnode.setAttribute("className", 'classname);
new Draggable(newnode.id,{revert:true});
element.parentNode.removeChild(element);
}
I replaced the code with "alert()" and it started working fine, so something in that last block isn't working well. I had to modify a lot of their code to make it work with the current version of scriptaculous, but i'm not all that familiar, so it could have something to do with old code? Or there could just be something wrong with it that I'm not good enough to see.