Detect If Scrollbars Visible

D

delraydog

Is there anyway to detect if scrollbars were made visible in a
textarea? I'm not talking about initial setting of the scrolling
attribute, but rather whether scrollbars have been added either
horizontally or vertically based on the users text input?

Thanks,
Cliff.
 
R

Randy Webb

Is there anyway to detect if scrollbars were made visible in a
textarea? I'm not talking about initial setting of the scrolling
attribute, but rather whether scrollbars have been added either
horizontally or vertically based on the users text input?

Nope. Well, maybe make the textarea just large enough for a scrollbar
and 1 character visible. But to make a textarea of significant size and
then determine if scrollbars are present, no.
 
R

RobB

Is there anyway to detect if scrollbars were made visible in a
textarea? I'm not talking about initial setting of the scrolling
attribute, but rather whether scrollbars have been added either
horizontally or vertically based on the users text input?

Thanks,
Cliff.

Have a play at this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<form>
<input type="text" name="sc" value="">
<br>
<textarea
rows="3"
cols="24"
wrap="soft"
onkeyup="
sH.value=a=this.scrollHeight;
oH.value=b=this.offsetHeight;
sW.value=c=this.scrollWidth;
oW.value=d=this.offsetWidth;
sc.value=(a>b||c>d)?'scrolling...':''"></textarea>
<hr>
<input type="text" name="sH" value="">__scrollHeight
<br>
<input type="text" name="oH" value="">__offsetHeight
<hr>
<input type="text" name="sW" value="">__scrollWidth
<br>
<input type="text" name="oW" value="">__offsetWidth
<hr>
</form>
</body>
</html>

Some sort of algorithm in there somewhere...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top