473,545 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 23 '05 #1
6 4569


stuart wrote:
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.


<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:
http://bugzilla.mozilla.org/show_bug.cgi?id=229089
I also do not get any onscroll handler to fire with Opera 7 here.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
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!
Jul 23 '05 #3


Stuart Cochrane wrote:
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 a complete example that works for me with IE 6:
http://home.arcor.de/martin.honnen/j...t20040714.html

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #4
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!
Jul 23 '05 #5
Stuart Cochrane wrote:
Thanks Martin,
I've been out of the office - the script was exactly what I needed.
Stuart


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
Jul 23 '05 #6
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!
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3627
by: Mark | last post by:
How do I scroll two textareas in sync with FireFox/Mozilla? The IE solution has been posted before by Martin Honnen.
5
4543
by: bwucke | last post by:
Is there any way to scroll textarea (to the bottom row) from Javascript in Opera? The textarea.scrollTop=textarea.scrollHeight+textarea.scrollTop; approach doesn't work, and there's so many notices that it doesn't all over the net, that if there's any solution/workaround to this problem on the net, it's unfindable. Alternatively (my...
4
7744
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can find the text and select it using the function below, BUT I can't figure out how to have the textarea automatically scroll to the selection in...
5
1518
by: K. | last post by:
Hi! I have such code: <textarea name="text_field">very long text</textarea> I have filled in the value of textarea field. This value is a very long string. I would like to scroll this textarea field into the end.
3
2432
by: Roe | last post by:
What is the best way using C# .NET 1.1 to have two (or more) applications perform a "synchronized" scrolling? These applications will all be C# .NET and will be on the same machine. The effect I need to create is if one program enables this "sync" feature, other instances of this application will scroll in sync while the base one's scroll...
1
2270
by: Anirhudra | last post by:
I have a TextArea and there I want to write my tracefile info .... but I want to see the scrolling automatically and to see the last line of my tracefile info within this TextArea without scrolling. Here is my HTML file ... FORM name="TraceFile"> <TextArea Name = "commentbox" ROWS="8" COLS="70"></TextArea>
58
8018
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also the parts section an i seem to be having trouble. When i try to insert into the parts section i get the error Invalid character value for cast...
482
27313
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my...
0
7410
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7773
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5984
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.