W3C home > Mailing lists > Public > www-amaya-dev@w3.org > March 2003

get byte offset from document

From: li zhang cis student <lz3@oak.njit.edu>
Date: Fri, 21 Mar 2003 10:46:54 -0500 (EST)
To: www-amaya-dev@w3.org
cc: www-amaya@w3.org
Message-ID: <Pine.GSO.4.53.0303211031340.7949@argerich.njit.edu>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:49:00 GMT