Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Width of the scroll bar in browser

Status
Not open for further replies.

vinayak

Technical User
Sep 17, 2001
50
IN
Hi,
I'm generating scrollbars in a web page using <DIV> tag Example: [<DIV style=&quot;HEIGHT: 200px; LEFT: 200px; OVERFLOW: Auto; TOP: 125px; WIDTH=100%&quot;>]

Is there a script OR any system variable which gives info about the width of the scrollbar's being generated?

Target browers are IE & NS for both Window & Mac operating systems.

Thank in advance,
Vinayak
 
I don't know of a cross-browser version, but this works in IE:

<DIV id=&quot;mydiv&quot; style=&quot;HEIGHT: 200px; LEFT: 200px; OVERFLOW: Auto; TOP: 125px; WIDTH:100%&quot;>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
</div>
<script>
alert('Scroll bar width: '+ (document.getElementById(&quot;mydiv&quot;).offsetWidth-document.getElementById(&quot;mydiv&quot;).clientWidth))
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top