SpArKy wrote:
For e.g, I have a textarea and I want to get only the selected text
(the text I mark with the mouse).
Anybody?
ThX
function ShowSelectedText()
{
if (window.getSelection) // recent Mozilla versions
{
var selectedString = window.getSelection();
}
else if (document.all) // MSIE 4+
{
var selectedString = document.selection.createRange().text;
}
else if (document.getSelection) //older Mozilla versions
{
var selectedString = document.getSelection();
};
alert("The text you selected is \n'" + selectedString + "'");
}
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html