danab
01-06-2003, 02:34 PM
How does one get the information about the postion of an HTML element?
I tried testing a simple html page that would alert me of the position of a <button> element in the page.
It did not work.
This was the code:
-----------------------
<html>
<body onload="test()">
<button id=obj name=obj>OBJ</button>
</body>
<script language=javascript>
function test()
{
alert(document.all.obj.width);
}
</script>
</html>
-----------------------
I just get 'Undefined' in my alert window.
Why did it not work?
Thanks.
Danny Abraham.
I tried testing a simple html page that would alert me of the position of a <button> element in the page.
It did not work.
This was the code:
-----------------------
<html>
<body onload="test()">
<button id=obj name=obj>OBJ</button>
</body>
<script language=javascript>
function test()
{
alert(document.all.obj.width);
}
</script>
</html>
-----------------------
I just get 'Undefined' in my alert window.
Why did it not work?
Thanks.
Danny Abraham.