why can i not divide this?

Giganews Newsgroups
Subject: why can i not divide this?
Posted by:  Dan (…@mail.xy)
Date: Thu, 24 Jul 2003

Hi,

I want to get the height of an element and dividing by 2, but i don't know
how.
See the code:
<DIV ID="myDiv" STYLE="position:absolute; height:200">
....</div>

<script>
myObj = document.getElementById("myDiv").style;
dw = myObj.height / 2;
alert(dw)
</script>

Without dividing, i get '200px'.
With dividing, it produces "NaN".
I also tried dw=parseFloat( myObj.height / 2).

Thanks for help.
Dan.

Replies