473,396 Members | 1,748 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,396 software developers and data experts.

selectionStart / selectionEnd and FF 1.0pr

Hi,
Previously I have this code working in FF 0.9 in a web forum :

bodytext = (document.all) ?
document.selection.createRange().text:document.get Selection();
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
else if (document.postform.body.setSelectionRange){
bodytext =
document.postform.body.value.substring(document.po stform.body.selectionStart
,document.postform.body.selectionEnd)
}

With the advent of FF 1.0, this is now broken and returns bodytext as blank.
Does anyone know of any changes in the scripting that would have caused this
or suggest a remedy?

Cheers
Jul 23 '05 #1
4 2489


snoopy wrote:

Previously I have this code working in FF 0.9 in a web forum :

bodytext = (document.all) ?
document.selection.createRange().text:document.get Selection();
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
else if (document.postform.body.setSelectionRange){
bodytext =
document.postform.body.value.substring(document.po stform.body.selectionStart
,document.postform.body.selectionEnd)
}

With the advent of FF 1.0, this is now broken and returns bodytext as blank.
Does anyone know of any changes in the scripting that would have caused this
or suggest a remedy?


What kind of element is document.postform.body, a <textarea>, an <input
type="text">, an <input type="password">?
Do you have a test case where it fails?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Ahh - sorted.
The useragent wasnt being detected correctly.
Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
reason.....
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread4.arcor-online.net...


snoopy wrote:

Previously I have this code working in FF 0.9 in a web forum :

bodytext = (document.all) ?
document.selection.createRange().text:document.get Selection();
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
else if (document.postform.body.setSelectionRange){
bodytext =
document.postform.body.value.substring(document.po stform.body.selectionStart ,document.postform.body.selectionEnd)
}

With the advent of FF 1.0, this is now broken and returns bodytext as blank. Does anyone know of any changes in the scripting that would have caused this or suggest a remedy?


What kind of element is document.postform.body, a <textarea>, an <input
type="text">, an <input type="password">?
Do you have a test case where it fails?
--

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

Jul 23 '05 #3
snoopy wrote:
Ahh - sorted.
The useragent wasnt being detected correctly.
It very seldom is, and this is just another case to back up the object
detection route instead of browser detection.

Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
reason.....


Because you are relying on an unreliable method to determine it.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
snoopy wrote:
Ahh - sorted.
The useragent wasnt being detected correctly.
Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
reason.....
[...]
[top post]


<http://pointedears.de/scripts/test/whatami>
<http://jibbering.com/faq/>
PointedEars
--
Stop Repeat Offenders. (Quit re-electing them.)
Jul 23 '05 #5

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

Similar topics

0
by: DraguVaso | last post by:
Hi, For my VB.NET-application I want to indicate in a label the SelectionStart and the SelectionLength when the user selects some text in a Cell in a DataGrid. Does anybody knows in which...
15
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
1
by: jen_designs | last post by:
I need to find a way to determine the character position of a users selection in a div. I can do this with the following using an input text box. Any way for a div or any text within the body...
2
by: Gary Shell | last post by:
I have a very ODD situation. I have a RichTextBox and a button. In the button click event I have the following: me.richtextbox1.SelectedText="test" Assuming I start with "aaaabbbbcccc" in...
8
by: vbmark | last post by:
I want the MonthCalendar control to return the single day selected. I have MaxSelectionCount = 1. What I get back though is this: "SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005...
2
by: marfi95 | last post by:
Hi all, I am trying to change the color of text that the user sees when they are editing a richtextbox. This is the code I am using in the TextChanged method of RichTextBox control. Dim...
1
by: mosquito.dotnet | last post by:
I am getting clearly wrong values from TextBox.SelectionStart property in C# code. For example, if I move caret one character to right by pressing Keys.Right, sometimes declared SelectionStart...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hello I've created a .NET 2.0 form and added 6 text boxes, 1 combo box and 2 button controls. The combo box has a DropDownStyle of DropDown, so the user can still type in the combo box. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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...

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.