Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

highlighted text copied into a form textarea with the click of a butto

8:04 pm on May 2, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 8, 2004
votes: 0

anyone know how to do it?
can someone give me an example?

I also will need to fetch message id's or userid's along with the highlighted text

thx :)

3:21 am on May 4, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 27, 2001
votes: 0

As far as I know, selected text to form only works with IE. Here's an example that shows how it works.

<script type="text/javascript">
function insertText() {
if (document.selection && document.selection.createRange) {
var str = document.selection.createRange().text;
document.selection.createRange().text = str;
<p>Select this text and click this <a href="javascript:insertText()">link</a>.</p>
<form><textarea cols="50" rows=
"1" name="body"></textarea></form>

I wrote a really cool selected text to form script, complete with a custom context menu, for use in the forum listed in the site in my profile. It's a good example of how handy this feature can be.

I wish Opera and FireFox would support selected text to form.

5:07 am on May 4, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 8, 2004
votes: 0

ow but Firefox does support it, I know a site which uses it and I only use Firefox

I looked at the Javascript, but its way to complicated for me to understand hehehe

thx for the help, I'll try it out


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members