Possible Duplicate:
Understanding what goes on with textarea selection with JavaScript
Copy and paste the selected text to the clipboard using JavaScript
I'm a little confused about how i should approach this, i have a textbox in this area i want a user to be able to highlight a word in textbox. I need to capture the highlighted word. It works in all browsers except Mozilla.
Here Im using onkeydown event.
var startPos = textComponent.selectionStart;
var endPos = textComponent.selectionEnd;
selected = textComponent.value.substring(startPos,endPos);
This is a code i used it for Mozilla. It is not working.
Please help me