Style.Left += n
What's the problem with:
document.img1.style.left += 20
That will result in NaN, i.e. not a number. Kill the 'px'.
This assumes that style.left is set, and not empty. If it's empty, it will fail, and you'll need a condition that checks this (and uses 0 for the calculation if so) or gets the left some other way, e.g. .offsetLeft).
document.img1.style.left = parseInt(document.img1.style.left) + 20 + "px";
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread