an**********@to talise.co.uk wrote:
I think I have sorted the problem
if (document.getEl ementById('divI D').scrollHeigh t >
document.getEle mentById('divID ').clientHeight )
.... can anyone see any problems with this?
The below code fails to detect a horizontal scroll bar on Firefox
<div id=div1 style="border:1 px solid
red;width:120px ;height:50px;ov erflow:auto">
There_once_was_ a_boy_from_nod_ Who_carried_a_l ot_of_sod</div><br>
<div id=div2 style="border:1 px solid
red;width:120px ;height:50px;ov erflow:auto">
There once was a boy from nod Who carried a lot of sod</div>
<script type='text/javascript'>
function scrollDetect(el emId) {
var elem = document.getEle mentById(elemId );
if (elem.scrollHei ght > elem.clientHeig ht) {
alert("code says scroll bar is present on '" +
elemId + "'\n" + elem.scrollHeig ht +
", " + elem.clientHeig ht);
} else {
alert("No scroll bar detected for '" +
elemId + "'\n" + elem.scrollHeig ht +
", " + elem.clientHeig ht);
}
}
scrollDetect('d iv1');
scrollDetect('d iv2');
</script>
Csaba Gabor from Vienna