Detect If Scrollbars Visible

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • delraydog@gmail.com

    #1

    Detect If Scrollbars Visible

    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.

  • Randy Webb

    #2
    Re: Detect If Scrollbars Visible

    delraydog@gmail .com wrote:
    [color=blue]
    > 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?[/color]

    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.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly

    Comment

    • RobB

      #3
      Re: Detect If Scrollbars Visible

      delraydog@gmail .com wrote:[color=blue]
      > 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.[/color]

      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="">__scro llHeight
      <br>
      <input type="text" name="oH" value="">__offs etHeight
      <hr>
      <input type="text" name="sW" value="">__scro llWidth
      <br>
      <input type="text" name="oW" value="">__offs etWidth
      <hr>
      </form>
      </body>
      </html>

      Some sort of algorithm in there somewhere...

      Comment

      Working...