gf3
asked on
Get element attributes issue
Here's my problem, I have a div, and the posotion is set to absolute, and it is placed via CSS (e.g top and left values). I need to be able to read and set those from javascript, so naturally I call
var id = 'someDiv';
var xPos = document.getElementById(id ).style.le ft;
xPos = parseInt(xPos);
alert('xPos = '+xPos);
For some reason, untill I set the actual left value via javascript all I get is 'xPos = NaN'? I need to be able to retreive the original X, Y coordinates of a dive before I set the new position, due to the nature of the code that I'm writing. All help is appreciated! Thanks in advance,
<3 gf3
var id = 'someDiv';
var xPos = document.getElementById(id
xPos = parseInt(xPos);
alert('xPos = '+xPos);
For some reason, untill I set the actual left value via javascript all I get is 'xPos = NaN'? I need to be able to retreive the original X, Y coordinates of a dive before I set the new position, due to the nature of the code that I'm writing. All help is appreciated! Thanks in advance,
<3 gf3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER