Scrolling Multiple Textarea in sync

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stuart

    Scrolling Multiple Textarea in sync

    I have two textareas on a HTML page. If a user scrolls in one textarea
    I want the other textarea to scroll as well. In otherwords I want both
    textareas to scroll up and down in unison.

    Can anyone help.

    Thanks

    Stuart
  • Martin Honnen

    #2
    Re: Scrolling Multiple Textarea in sync



    stuart wrote:
    [color=blue]
    > I have two textareas on a HTML page. If a user scrolls in one textarea
    > I want the other textarea to scroll as well. In otherwords I want both
    > textareas to scroll up and down in unison.[/color]

    <form ...>
    <texarea onscroll="this. form.elements.t extarea2.scroll Top =
    this.scrollTop; " name="textarea1 " ...></textarea>
    <textarea onscroll="this. form.elements.t extarea1.scroll Top =
    this.scrollTop; " name="textarea2 " ...></textarea>
    </form>
    should work with IE to synchronize vertical scrolling.
    Mozilla has a bug with onscroll for <textarea> elements so that is
    doesn't work there:
    RESOLVED (events) in Core - DOM: Events. Last updated 2008-11-13.

    I also do not get any onscroll handler to fire with Opera 7 here.


    --

    Martin Honnen


    Comment

    • Stuart Cochrane

      #3
      Re: Scrolling Multiple Textarea in sync

      Hi Martin,

      i have tried adding the code to my page but it is not working - i am
      using ie6. do i need to add anything else to the code ?

      Here is the code:


      <td align=center>
      <textarea rows="50"
      onscroll="this. form.elements.i nterim_feedback .scrollTop =
      this.scrollTop; " cols="45" name="accountab ilities_and_mea sures" style="
      font-family:Arial, Helvetica, sans-serif;color:bla ck; font-size:
      8pt"><%= accountabilitie s_and_measures %></textarea>
      </td>
      <td align=center>
      <textarea rows="50" cols="45"
      onscroll="this. form.elements.a ccountabilities _and_measures.s crollTop =
      this.scrollTop; " name="interim_f eedback" style=" font-family:Arial,
      Helvetica, sans-serif;color:bla ck; font-size: 8pt"><%= interim_feedbac k
      %></textarea>
      </td>

      Thanks

      Stuart

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Martin Honnen

        #4
        Re: Scrolling Multiple Textarea in sync



        Stuart Cochrane wrote:
        [color=blue]
        > i have tried adding the code to my page but it is not working - i am
        > using ie6. do i need to add anything else to the code ?[/color]

        Here is a complete example that works for me with IE 6:


        --

        Martin Honnen


        Comment

        • Stuart Cochrane

          #5
          Re: Scrolling Multiple Textarea in sync

          Thanks Martin,
          I've been out of the office - the script was exactly what I needed.
          Stuart



          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • Wired Earp

            #6
            Re: Scrolling Multiple Textarea in sync

            Stuart Cochrane wrote:
            [color=blue]
            > Thanks Martin,
            > I've been out of the office - the script was exactly what I needed.
            > Stuart[/color]

            If you are desperate for Mozilla support, you can hack up a solution by
            listening for "curpos" transmissions from the DOMAttrModified event. Let me
            know if this is the case.


            --
            Wired Earp
            Wunderbyte

            Comment

            • Stuart Cochrane

              #7
              Re: Scrolling Multiple Textarea in sync

              Hi,

              Is it possible to increase the synchronisation and force the second
              textarea to start scrolling even when there is nothing in it? In other
              words as a row is created in the first textarea can we automatically
              create a row in the second - this would ensure that both text boxes have
              exactly the same number of rows and force synchronisation b.

              Thanks for any help

              Stuart

              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              Working...