Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
98
rated 0 times [  100] [ 2]  / answers: 1 / hits: 65421  / 13 Years ago, sun, november 6, 2011, 12:00:00

I have a div tag declared like this:



<div id=carRight style=position:absolute; left:600px; top:170px;>
<img src=carRight.png width=256 height=256 />
</div>


After a quick animation, I'd like to move the left position when a button is pressed. I tried a few variations of this, but it doesn't seem to be correct:



document.getElementById('carRight').style.left=600;
document.getElementById('carRight').style.position.left=600;


What is the correct statement to use? Thanks.


More From » javascript

 Answers
14

Try:



document.getElementById('carRight').style.left=600px;

[#89284] Thursday, November 3, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
serena

Total Points: 488
Total Questions: 125
Total Answers: 114

Location: Estonia
Member since Wed, Jun 8, 2022
2 Years ago
;