get byte offset from document

Hi All,

I have a question about how to get the byte offset
of selected text from a HTML file. For example,
if I have the following HTML file:

...
<html>
<head>
<title>This is a test example</title>
</head>
<frame>
<body><tr><h1>test test test</h1></tr>
<h2>test test</h2>
</body>
</frame>
</html>
...

If the user selects "test" from the screen,
I need to know the position of this "test"
in the HTML file. Because there are 6 "test"
string in the file, I need to know which one
does the user selects.
Does Amaya has a way to support this? Or any other
browser? I know I can use javascript to get
the content of the selection (document.getselection),
but I don't know how to get the byte offset of
this selection.


Thanks

Li

Received on Friday, 21 March 2003 10:47:01 UTC