HighDots Forums  

Getting selection from textarea within a div

alt.html.dhtml alt.html.dhtml


Discuss Getting selection from textarea within a div in the alt.html.dhtml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Net Man
 
Posts: n/a

Default Getting selection from textarea within a div - 09-20-2004 , 12:51 PM






I'm tring to get the user selected text from a textarea included in a div like this:

<head>
<script ...>

function GetSele()
{
var str = document.selection.createRange().text;
alert(str);
}

</script>
....
</head>
<body>
....
<form name="theform" action="theaction" method="POST">
....
....
<div id="win">

<a href=\"javascript:GetSele();\"><img src=\"animage.gif\"></a><br>
<textarea name=\"edit_text\"></textarea>

</div>
</form>

</body>

but the result is an empty string. Any suggestion?
thanks in advance!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.