473,856 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Highlight text into textarea

Hola boys, i've a question for you!
It's possible to highlight some text inside a textarea? (not all text,
but a portion!)
For example, i've this text inside a textarea.

[ B ] INSERISCI TESTO [ /B ]

i want to highlight only "INSERISCI TESTO".
It, must be an universal function, so i can use it also in other cases,
for example when tag are [ SM ] and [ /SM].
I hope someone can help me, because through internet i find only code IE
compatible e not FIREFOX compatible, and viceversa.
I'd like to have compatibility with both browser.

Thank you so much, for your help.
I'm waiting for you...

tranky
May 16 '06 #1
1 7490
tranky wrote:
Hola boys, i've a question for you!
It's possible to highlight some text inside a textarea? (not all text,
but a portion!)
For example, i've this text inside a textarea.

[ B ] INSERISCI TESTO [ /B ]


In Mozilla/Firefox, you can highlight a single contiguous region in a
textarea via textarea.setSel ectionRange(sta rtPos, endPos). The
selection is only visible while the textarea has focus AND before the
textarea first has focus
(https://bugzilla.mozilla.org/show_bug.cgi?id=332424).

In FF, there is a second (manual) way to achieve highlighting in a
textbox, but I have not looked into the possibilities of invoking it
with javascript. To be useful, I would think that it would have to
allow for regular expressions as a specifier: Do a search via ctrl+f.
By https://bugzilla.mozilla.org/show_bug.cgi?id=252371 sought text in
the textarea will not be highlighted. However, if you now press alt+a
you can see all found instances highlighted, including in the
textareas.

If you find javascript access to the presumed highlightAll function, it
would be great if you would post back details. Especially useful would
be the ability to restrict the scope of such a highlightAll function.

Csaba Gabor from Vienna

May 16 '06 #2

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

Similar topics

4
9341
by: Doug van Vianen | last post by:
Hi, I am working on an Applet which provides some mouse practice for new computer users in our local seniors' computer club. The applet contains several cards, in a card layout, which are displayed to the user one after the other as needed to present some particular mouse operation. This all works fine. One card (card 4 below) includes a textarea and a button. What I wish to do is have the user use the mouse to select some text from the...
1
2891
by: Dan Williams | last post by:
Does anyone know if its possible to get the line number of a textarea form element when a user clicks on a specific line, and hence highlight it? If so, can you point me in the right direction of the code to do so. Many thanks Dan Williams.
3
2058
by: John | last post by:
var tmpelem; tmpelem=document.getElementById("MyTableId"); tmpelem.select(); doesnt work - any ideas how I can get around this? I only want to highlight the table and all child nodes. Thanks! J
3
4370
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
1
3777
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
5
10926
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be appreciated. Thanks. Atara. ------------------------- Original code:
2
3744
by: science | last post by:
It seems there is a difference between 1)highlighting text in a textarea then deleting it and 2)pressing the delete button multiple times. When I delete using method 2. And send the contents of the textarea to a java method that takes a string(ie the textarea string) and updates its local string variable. The local string variable is unchanged. It appears deleting using method 2 does not send an empty string?? Please help
0
9916
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11057
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10696
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10384
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9531
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7094
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5761
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.