Hi,
I tried this code it works fine.Try once
If you use Jquery you can pass capture text to server.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language ="javascript" >
document.onselectstart = df;
document.onmouseup = dfu;
function dfu(event) {
document.getElementById("showtextid").innerHTML = "selection ended the selected text is : " + document.selection.createRange().text+"";
}
function df(event) {
document.getElementById("showtextid").innerHTML = "selection started" ;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="showtextid"></div><br />
this is just for testing
I am interested in saving text when user selects any text anywhere on a web page that text has to be highlighted and has to save that text as a string in C#.
when same user saw same page next time text has to be highlighted as done previously by him.
If anyone knows a simple elegant way to do this I would really appreciate it, but I'll take any solution at this point. Even if you can point me in the right directions that would be appreciated. Thanks in advance.
</div>
</form>
</body>
</html>
If you are using Jquery then no problem.
I hope you understood what I did
Use $.post() to post selected data to server and save in database .
All the Best.