[Javascript] Wolter Zorn's Drag and Drop Script

Terry Riegel riegel at clearimageonline.com
Wed Aug 23 08:28:20 CDT 2006


Hello,

Roger, thanks you are right it was an event once I got that I was  
able to see that my addition was in the wrong place.

I am having trouble getting Walter Zorn's script working on IE6.0. I  
am able to go to his site http://www.walterzorn.com and his drag and  
drop library works just fine in IE6, but when I create a simple  
duplicate on my site it works for Safari, but not IE6. Would anyone  
care to take a look. I have tried to keep my example to the bare bones.

http://clearimageonline.com/projects/draganddrop/draganddrop.html

This example will load a picture that you should be able to drag  
around the page. It also has an alert link that displays the  
coordinates and size of the image. The library is starting to load as  
the alert link is correct, It just wont drag around.

Terry

On Aug 22, 2006, at 9:42 PM, Roger Roelofs wrote:

> Terry,
>
> On Aug 22, 2006, at 3:32 PM, Terry Riegel wrote:
>
>> I am working with a drag and drop library written by Walter Zorn.  
>> He does some pretty cool things with his script. As I look at his  
>> code I first realize that I don't really understand OOP.
> Javascript OOP is a bit different than other languages, so it takes  
> a while to understand it.
>
>> I am trying to add a property to an object. Can anyone tell me why  
>> my addition isn't working?
>>
>> dd.evt = function(d_e)
>> {
>> 	this.but = (this.e = d_e || window.event).which || this.e.button  
>> || 0;
>> 	this.button = (this.e.type == 'mousedown')? this.but
>> 		: (dd.e && dd.e.button)? dd.e.button
>> 		: 0;
>> 	this.src = this.e.target || this.e.srcElement || null;
>> 	this.src.tag = ("" + (this.src.tagName || this.src)).toLowerCase();
>> 	this.x = dd.Int(this.e.pageX || this.e.clientX || 0);
>> 	this.y = dd.Int(this.e.pageY || this.e.clientY || 0);
>>
>> // My humble addition
>> this.terryriegel = 723;
>> // End my humble addition
>>
>>
>> 	if(dd.ie)
>> 	{
>> 		this.x += dd.getScrollX() - (dd.ie && !dd.iemac)*1;
>> 		this.y += dd.getScrollY() - (dd.ie && !dd.iemac)*1;
>> 	}
>> 	this.modifKey = this.e.modifiers?  
>> this.e.modifiers&Event.SHIFT_MASK : (this.e.shiftKey || false);
>> };
>
> Two questions.  What makes you think it isn't working?  Do you use  
> this.terryriegel somewhere else in the code?  Also, 'this' in  
> javascript isn't always what you expect.  The code you pasted looks  
> like an event handler.  In this context, 'this' may well be the  
> window object rather than dd.
>
> This is one of those cases where a url would be especially helpful  
> in debugging.
>
> hth
> -- 
> Roger Roelofs
> Datacomp Appraisal Services
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list