Click to See Complete Forum and Search --> : Little bug in Drag and Drop javascript


Silly_TomcaT
09-16-2005, 10:56 AM
Hi,

Just a report for the script "The JavaScript Source: CSS: Drag and Drop". I've been looking for quite half a day and found it.
It's about the "parseInt" function wich causes problems with "8" and "9" values.
The correct way to write it should be (find it in the script) :
tx = parseInt(dobj.style.left+0,10);
ty = parseInt(dobj.style.top +0,10);

Almost drove me crazy !!! :p

sTom

LeeU
09-19-2005, 09:53 AM
sTom,

Thanks for the correction. But let me ask, I'm not sure what you mean by

causes problems with "8" and "9" values.

How does the 8 and 9 come into play?

thuko135
09-25-2005, 09:07 AM
It looks like he is referring to parseInt(8) as resulting in a problem. parseInt picks assumes the 8 is a hex-digit, rather than an decimal, and the correct fix is to, as shown, specify base 10.