473,480 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

finding cordinates of selected text

Hi

Pardon me if I am not making any sense.What I want to know the
cordinates of selected text by user so that i can save/retrieve them
later.is It possible.I am lookig for both IE and Firefox solution.
Thankyou

-adnan

Jun 30 '06 #1
4 2459

Adnan Siddiqi wrote:
Hi

Pardon me if I am not making any sense.What I want to know the
cordinates of selected text by user so that i can save/retrieve them
later.is It possible.I am lookig for both IE and Firefox solution.
Thankyou

-adnan


If you search this newsgroup using the terms "coordinate selected
text", then you will be able to find the following post which gives you
a starting point:-

<URL:http://groups.google.co.uk/group/comp.lang.javascript/browse_frm/thread/47f8544a7e1f5885/d49b5d2de4f0e048?q=coordinates+selected+text&rnum= 2#d49b5d2de4f0e048>

It is always advisable to search the group first, and then ask your
question.

Regards

Julian Turner

Jun 30 '06 #2


Adnan Siddiqi wrote:

Pardon me if I am not making any sense.What I want to know the
cordinates of selected text by user so that i can save/retrieve them
later.is It possible.I am lookig for both IE and Firefox solution.


What kind of selected text is that? For Mozilla/Firefox if the text
selected is in a text control (input, textarea) then those expose
input.selectionStart
input.selectionEnd
respetively
textarea.selectionStart
textarea.selectionEnd
If it is normal text not in a text control then check the selection
object API here
<http://www.xulplanet.com/references/objref/Selection.html#method_extend>
you get at that selection object by doing
var selection = window.getSelection();
then you would need to store
selection.anchorNode
selection.anchorOffset
selection.focusNode
selection.focusOffset
to be able to restore that selection later.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 30 '06 #3

Julian Turner wrote:
Adnan Siddiqi wrote:
Hi

Pardon me if I am not making any sense.What I want to know the
cordinates of selected text by user so that i can save/retrieve them
later.is It possible.I am lookig for both IE and Firefox solution.
Thankyou

-adnan

If you search this newsgroup using the terms "coordinate selected
text", then you will be able to find the following post which gives you
a starting point:-

<URL:http://groups.google.co.uk/group/comp.lang.javascript/browse_frm/thread/47f8544a7e1f5885/d49b5d2de4f0e048?q=coordinates+selected+text&rnum= 2#d49b5d2de4f0e048>

It is always advisable to search the group first, and then ask your
question.

Regards

Julian Turner
Sorry I will follow your advise while posting on newsgrops.I am
exploring the link you gave.

Thanks

-adnan

Jul 4 '06 #4

Martin Honnen wrote:
Adnan Siddiqi wrote:

Pardon me if I am not making any sense.What I want to know the
cordinates of selected text by user so that i can save/retrieve them
later.is It possible.I am lookig for both IE and Firefox solution.

What kind of selected text is that? For Mozilla/Firefox if the text
selected is in a text control (input, textarea) then those expose
input.selectionStart
input.selectionEnd
respetively
textarea.selectionStart
textarea.selectionEnd
If it is normal text not in a text control then check the selection
object API here
<http://www.xulplanet.com/references/objref/Selection.html#method_extend>
you get at that selection object by doing
var selection = window.getSelection();
then you would need to store
selection.anchorNode
selection.anchorOffset
selection.focusNode
selection.focusOffset
to be able to restore that selection later.

--

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

Dear Martin

It would definately not some text within form controls.I am talking
about the content which appear on page within commonly used tags but I
am not sure that whether some text is selected,it selects the TEXT only
or HTML behind it.I will go thru your xul link since i am actually
going to use script for a firefox extension.

It would be nice if I could have some example to implement these
selection functions.

-adnan

Jul 4 '06 #5

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

Similar topics

5
3186
by: Matthew Robinson | last post by:
Can anybody see what is wrong with this code? apparently i have an 'empty delimiter' on the line that sets $pos - can anybody see what is wrong with it? $search_for = $_GET;...
4
2900
by: Cengiz Ulku | last post by:
Hi, I've already posted a question similar but will need some precisions and help. I have a rtf file displayed within a RTB control. Above it, I have a text box control with a scroller which...
1
6462
by: Phil Watkins | last post by:
I am a novice programer in Vb and I am having a major brain ache finding out which item has been selected within a list view and then either deleting that item or editing them. My searching so...
2
16418
by: Mark Haase | last post by:
Hey All-- I'm rusty on my JavaScript but I'm pulling it back out to do a PHP/MySQL database application. I'm doing all the validation in PHP, but I'm using JavaScript to show/hide questions...
3
1294
by: VM | last post by:
How can I get the selected value of a Windows Listbox? It only has two items (which I added through the Collection property) and everytime I get the selectedIndex, it returns -1. If I use...
1
3146
by: Doug | last post by:
The html below shows DataList "DiscountList" nested within DataList "EventItemList". DiscountList contains a Label control. I'm trying to find the label, using FindControl, during...
5
6685
by: Brian Henry | last post by:
Say I put an item into a panel and place it onto a form, and I want to know where on the form the item is in X,Y positions... but If I check the location property of the item in the panel, that is...
1
1581
by: stenerson.j | last post by:
Hi, I need to change how a image and text appear on a screen. So instead of using the Top/left X/Y position to draw the image, I need to set the drawing origin to be the bottom/right. When I am...
2
1109
by: mail2indar | last post by:
I want to crate a float "div" popup. And the left - right - top of the popup should be on the bases of screen cordinates and page layout. Can some one help me, How i can calculate.
0
6918
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
7057
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
7102
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...
1
4798
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...
0
4495
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...
0
3008
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...
0
1310
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 ...
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
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...

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.