473,387 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

!Mozilla and caret in textarea

Hello.
I'm looking for any way to grab caret position in textarea (start, end -
if selection) in Internet Explorer. Is it at all possible?

Also any idea for doing it in Opera, KHTML would be appreciated :)

Greetings
Gandalf

Jul 20 '05 #1
5 3970


Zbigniew Braniecki wrote:

I'm looking for any way to grab caret position in textarea (start, end -
if selection) in Internet Explorer. Is it at all possible?


You subject asks about Mozilla, there (from 1.3 on) you can use

var textarea = document.forms[0].elements[0];
alert(textarea.selectionStart + '; ' + textarea.selectionEnd);


--

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

Jul 20 '05 #2
Użytkownik Martin Honnen napisał:

You subject asks about Mozilla


My subject asks about NOT Mozilla :) Gecko is the only engine where i
know how to do it :)

But in IE? Cannot find a way :(

Greetings
Zbigniew Braniecki

Jul 20 '05 #3


Zbigniew Braniecki wrote:
Użytkownik Martin Honnen napisał:

You subject asks about Mozilla

My subject asks about NOT Mozilla :) Gecko is the only engine where i
know how to do it :)


Looked like a typo to me, didn't expect any JavaScript operators applied
in a normal language sentence :)
But in IE? Cannot find a way :(


http://www.faqts.com/knowledge_base/...d/1052/fid/130

--

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

Jul 20 '05 #4
On Wed, 14 Jan 2004 15:53:20 +0100, Zbigniew Braniecki
<ni******@poczta.onet.pl> wrote:
Użytkownik Martin Honnen napisał:
You subject asks about Mozilla


My subject asks about NOT Mozilla :) Gecko is the only engine where i
know how to do it :)


In the future, it might be better to use English, rather than logical
operators, to define your meaning.

The TextRange object might be useful, but as I've never used it, I
couldn't say. It seems to be the only relevant item.

Mike
From the DHTML Reference in the MSDN Library (beware of URL wrap)

The TextArea object:
http://msdn.microsoft.com/workshop/a...s/textarea.asp

The TextRange object:
http://msdn.microsoft.com/workshop/a..._textrange.asp

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #5
Użytkownik Martin Honnen napisał:
http://www.faqts.com/knowledge_base/...d/1052/fid/130


This allows me to put text into textarea at caret position.
I don't want to do this. I want to grab position of caret. Similar as
textarea.selectionStart property in Gecko.

Greetings
Zbigniew Braniecki
Jul 20 '05 #6

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

Similar topics

3
by: Noah | last post by:
I have a text field in a form. I want the user to be able to click a DELETE button and have the character at the cursor position deleted. This would be just as if the user had pressed the Back...
3
by: Parrot | last post by:
Does anyone else have a problem with the Mozilla browser not expanding a multi-line textbox to its proper size? My textboxes are all small and do not display mu;tiple lines in Mozilla or Netscape...
7
by: Paul Gorodyansky | last post by:
Hi, Say I have a text in my TEXTAREA box - 01234567890 I want - using script - insert say "abc" in the middle. Works almost OK in Internet Explorer (with one problem) based on their example...
9
by: Paul Gorodyansky | last post by:
Hi, FAQ tells how to insert (or replace0 a text at a caret position in Mozilla (and same works for Opera 8+), for example, at http://www.faqts.com/knowledge_base/view.phtml/aid/1661 it talks...
4
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...
3
by: gleery | last post by:
We can add a caret in textarea, but when I inspect FCkEditor with firebug, I don't find a textarea tag, but still there is a caret there. I wonder how Fckeditor do that? Anyone know that?
3
by: sandromani | last post by:
Hi all, I am writing a webbased notepad and want to include syntax-coloring. The approach I have used is to set the font color and background color of the textarea to transparent, and place the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
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...

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.