get byte offset from document
li zhang cis student <[email protected]>
| Newsgroups | gmane.comp.web.amaya.devel,gmane.comp.web.amaya.general |
|---|---|
| Message-ID | <[email protected]> |
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