mattquantic
Programmer
Hi. I amtrying to use JS to establish the top and left positions of a relativly positioned div layer.
But, without setting those properties initially.
For example:
then test the change by using: (added some <br><br>s)
The style property is looking for the preset attributes, which are not there - which is why I'd imagine its not working. But, the div must know its position? Is there any other way that I can determine this?
M@)
But, without setting those properties initially.
For example:
Code:
<div id="div1" style="position:relative;z-index:1;">
hello
</div>
<script type="text/javascript" language="JavaScript">
alert(document.getElementById('div1').style.left);
</script>
then test the change by using: (added some <br><br>s)
Code:
<br><br>
<div id="div1" style="position:relative;z-index:1;">
hello
</div>
<script type="text/javascript" language="JavaScript">
alert(document.getElementById('div1').style.left);
</script>
The style property is looking for the preset attributes, which are not there - which is why I'd imagine its not working. But, the div must know its position? Is there any other way that I can determine this?
M@)