get value from css using document.getElementById().style.height javascript -
Please provide insight into this secret.
I am trying to get the height value from a div box
var high = document.getElementById ("Hinteviv"). Style.height; Warning (high);
I can only fix this value if the attribute is included in the div tag but it gives an empty value if the attribute is defined in the CSS section.
It's okay, it shows 100px as a value, value can be reached.
& lt; Div id = "hintdiv" style = "height: 100px; display: none;" & Gt; . . Var high = document.getElementById ("HintDiv"). Style.height; Warning (high);
This is not okay, it shows an empty warning screen value is practically 0.
#hintdiv {height: 100px display: none; } & Lt; Div id = "hintdiv" & gt; . . Var high = document.getElementById ("HintDiv"). Style.height; Warning (high);
But I have no problem entering or changing the "Display: None" feature, whether it is in tags or in the CSS section. The Divi box displays correctly by both definition methods (inside the tag or in the CSS section)
I also tried to use value from other forms, but no luck
document.getElementById ("hintdiv"). Style.height.value ----> Undefined document.getElementById ("hintdiv") height ---- & gt; Undefined document. GetElementById ("hintdiv") height.value ---- & gt; Error, no execution
Any solution?
TIA
The reason for this is that, when you use document.getElementById ("hintdiv") Are there. Style.height;
If you're reaching the tag's style
attribute, if the feature is not there, then you do not get any value.
Instead you should use the object in IE and function in the rest of the web browser.
Comments
Post a Comment