finding cordinates of selected text

A

Adnan Siddiqi

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
 
J

Julian Turner

Adnan said:
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/co...dinates+selected+text&rnum=2#d49b5d2de4f0e048>

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

Regards

Julian Turner
 
M

Martin Honnen

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.
 
A

Adnan Siddiqi

A

Adnan Siddiqi

Martin said:
Adnan Siddiqi wrote:



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.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top