Link to home
Start Free TrialLog in
Avatar of potatotsang
potatotsang

asked on

capture highlighted text. how?

in IE, can anyone propose me how to capture the text highlighted by dragging the mouse?
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
These lines:
   var range=document.selection.createRange();
    rangeText="<b>"+range.text+"</b>";
    range.text=rangeText;
does the trick.
var range=document.selection.createRange();
alert(range.text);

will give you the selected text.
Avatar of potatotsang
potatotsang

ASKER

ic thx..
i have wasted my time in browsing thru the events.
missed the seleciton object.

thx alot.

i am new to the modern object model of IE.
looking forward to give u more points =)

Spud->Regards();
Glad I could help :-)