Click to See Complete Forum and Search --> : detecting div tag's scrollbar


rparker
02-25-2003, 08:43 AM
Hello,

I have the following tag in my html page:

<div id='divTag' style="overflow: auto; height:'100%'; ">

When the page loads I'd like to query this div tag to see if the scrollbar is currently visible. I have tried varieties of the following:

window.document.getElementById("divTag").style.overflow

but can't seem to find any information of value. Any ideas would be greatly appreciated!

Thanks!
Rachel

gil davis
02-25-2003, 09:09 AM
It's not that easy, but not too hard:

((document.getElementById("divTag").style.offsetHeight > document.getElementById("divTag").style.clientHeight) || (document.getElementById("divTag").style.offsetWidth > document.getElementById("divTag").style.clientWidth))

If this comparison is true, then the scrollbars should be there.

rparker
02-25-2003, 01:44 PM
Many thanks Gil, that works like a charm!