View Full Version : img.style.posTop = Math.floor(img.style.posTop)

06-08-2003, 04:03 AM
img.style.posTop = Math.floor(img.style.posTop)

I think this doesn't work, that it doesn't floor the number correctly....
What do you think?

Now that I think of it, document.write(img.style.posTop) doesn't work either.... How can I operate on the position of an object using Javascript? (I've tried top instead of posTop to no result)

Mr J
06-08-2003, 09:41 AM
It should work, what are you trying to do?

06-08-2003, 05:02 PM
I'm trying to do this:

get the position of "img", and make that number a whole number.
That's because I define the position of "img" with percentages, so I'm not sure it's a whole number. I want it to be a whole number because if it's not, the function I use to move "img" will not work since it goes +1 until it reaches 10 (If it's not a whole number, it will never reach 10)
You can see that part of my script here (http://www.codingforums.com/showthread.php?threadid=21278)