Hi
I have a loop looping through an "band" object array. I am assigning a anonymous functions for the object property(actually dragging)

for (var j=0;j<5;j++)
	{
		var othis = this.bands[j];
		othis.onDragstart = (function() {return othis.onDragstartResizeHandle()});
	}

onDragstartResizeHandle function

band.prototype.onDragstartResizeHandle = function()
{
  alert(this.id);
}

when I drag a band it always alert the id of 5th band. not the id of that band which i am currently refering. (even this is a anonymous function)
Cansomeone please tell me why?

othis.onDragstart = (function() {return othis.onDragstartResizeHandle()});

This is crazy. If i not travelling a loop and access objects one by one like

var othis1 = this.bands[0];
othis1 .onDragstart = (function() {return othis1 .onDragstartResizeHandle()});
var othis2 = this.bands[1];
othis2 .onDragstart = (function() {return othis2 .onDragstartResizeHandle()});

Now onDragstartResizeHandle function alert 2nd band id always. please help