Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: open

Message Too Old, No Replies

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

     

dmmh

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

10+ Year Member



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 :)

Key_Master

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

WebmasterWorld Senior Member 10+ Year Member



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

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

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.

dmmh

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

10+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month