faqts : Computers : Programming : Languages : JavaScript : DHTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 23 people (52%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can i find the width and height of the Div tag After writing innerHTML to a div tag ?

Apr 26th, 2001 07:25
Marco Kleinschmidt, dries, Ian Grant, anand raj,


See http://www.faqts.com/knowledge_base/view.phtml/aid/7157/fid/128
This does not work for NS6 after innerHTML is used, it keeps the
original height.
Any ideas?
It works, I use it myself. Perhaps you overlooked, that a string and not
a integer is returned. This String something like "250px". So you might
want to get rid of the last two characters. Try the following:
hoehe=document.defaultView.getComputedStyle(document.getElementById(
 'HauptLayer'),"").getPropertyValue("height")
hoehe=eval(hoehe.substring(0,hoehe.indexOf("p")))
Marco