Hi,

I'm trying to figure out how to allow a user to annotate a text page that gets served to him or her. This annotation would be for their own consumption, so that they could just look at their annotations if they wanted to (like a notebook).

Here is my best thinking so far. Correct me if there is a better way.

I want the original copy to stay unmodified. All changes will be contained in a comment_master table (comment_key, user_id, comment). The highlighting information need to create the "look" is contained in a highlight_master table. This would contain the starting and stopping words or spaces or position numbers (what ever works and is easiest). This one-to-many structure is needed because I usually highlight several spots and make one comment to tie them together.

When the person wants to view their annotations, a copy of the original document is populated with the appropriate tags based on the above information.

My question is: "What is the most efficient way to store and recreate the annotated stuff?

I can get the initial selected phrase or word using javascript and document.getSelection() and document.selection.createRange() . After that I am at a loss.

Do I store the whole phrase and the occurance number or just the stop and start words and their occurance number? I had wanted to use the Strrpos function and get the position number for the stop and start tags but I can't see how to insert the needed tag based on the position number.

Any help would be wonderful!!!

Thanks,

Marlow