I'm trying to write JavaScript that manages the text a user selects in a webpage, but I'm not sure where to begin; i.e., I was wondering if there was a way to limit the ability to select/highlight text so that the selection ends at a terminating punctuation mark, and the user cannot select anymore (And possibly trigger an alert window or send an event when that limit is first reached). Also, is there a way to change the colour of highlighted/selected text in a browser? I'm familiar with JavaScript pointer and click events, but I'm having trouble finding any information on what I'm looking for.
Thanks in advance.