473,810 Members | 3,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.select ion.createRange ().text:documen t.getSelection( );
if (selectedtext.c reateTextRange) {
selectedtext.ca retPos = document.select ion.createRange ().duplicate();
}
else if (document.postf orm.body.setSel ectionRange){
bodytext =
document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t
,document.postf orm.body.select ionEnd)
}

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 2502


snoopy wrote:

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

bodytext = (document.all) ?
document.select ion.createRange ().text:documen t.getSelection( );
if (selectedtext.c reateTextRange) {
selectedtext.ca retPos = document.select ion.createRange ().duplicate();
}
else if (document.postf orm.body.setSel ectionRange){
bodytext =
document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t
,document.postf orm.body.select ionEnd)
}

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.postfo rm.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*******@yaho o.de> wrote in message
news:41******** *************** @newsread4.arco r-online.net...


snoopy wrote:

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

bodytext = (document.all) ?
document.select ion.createRange ().text:documen t.getSelection( );
if (selectedtext.c reateTextRange) {
selectedtext.ca retPos = document.select ion.createRange ().duplicate();
}
else if (document.postf orm.body.setSel ectionRange){
bodytext =
document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t ,document.postf orm.body.select ionEnd)
}

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.postfo rm.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.javas cript 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
1431
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 event I can trap this, and how I can know those two values? Thanks a lot in advance,
15
3331
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) { var range = document.selection.createRange(); if (range.parentElement() == element) range.text = '<' + tag + '>' + range.text + '<\/' + tag + '>'; }
1
19020
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 tags? <html> <body> <form> <div onkeyup="s(this)" onclick="s(this)" id="myDiv">This is some text</div> <input type="text" onkeyup="s(this)" onclick="s(this)" value="This is
2
2374
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 the richtext box and I place the caret between the a and b and hit the button. I get "aaaatestbbbbcccc" as expected. Then I click between the b and the c and hit the button I get:
8
2622
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 12:00:00 AM" How do I get the single day date?
2
4568
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 position As Integer = rtb.SelectionStart rtb.Refresh() rtb.SelectionStart = position
1
4507
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 property actually decreases, sometimes it does not change. Difference seems always at most off by 1 but it is very irritiating. My setup is as follows: Textbox txtText, txtCursor; txtText.ReadOnly = true;
1
5210
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. The combo box has the follows values in it's drop down list: "Dear Sir,"
0
9722
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
10644
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
10379
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
10124
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
9200
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
5550
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
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
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
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.