...

View Full Version : style.overflow returns null?



wisar1111
03-11-2012, 10:46 AM
I know there is probably going to be an embarrassingly simple answer to my issue (like I am pointing to the wrong place in the DOM) but here goes. Why is the value of overflow not being returned by the below script?



<style type="text/css">

div.fbOverflow_Scroll { position:absolute; top:20px; left:20px; z-index:27;
overflow:scroll; overflow-x:hidden; height:30px; width:100px;
background-color:#FFB60D; border:1px Solid #000000; }

</style></head><body><form method='post' enctype='multipart/form-data' id='myForm' name='myForm'>

<!-- **** lab(Box10pt, fbOverflow_Scroll, , Extra=) -->
<div class='fbOverflow_Scroll' id='fbOverflow_Scroll' position=relative >
This is stuff inside of a little scrolling area of the form</div>

<script language="JavaScript">
alert(document.getElementById('fbOverflow_Scroll').style.overflow);
</script>

</form>

glenngv
03-11-2012, 11:07 AM
Using style will only return the inline style properties. You need to use currentStyle or getComputedStyle. Refer to this link (http://www.quirksmode.org/dom/getstyles.html) for more info.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum