copy & paste with a command button ?

G

Guest

hi guys,
I have a textbox & a button in an .aspx page, when I hit the button i want a
selected text
to be copied to the clipboard AND paste it into the last cursor position on
the textbox BOTH AT ONCE, that means, copying & pasting the text must happen
together on the Button_Click event handler!

when we use javascript to store the selected text into a variable, we must
use this code snippet:

var selectedHtml=(document.selection.createRange()).htmlText;
if(selectedHtml!= "")
document.getElementById("TextBox3").focus();
sel = document.selection.createRange();
sel.text = selectedHtml;

now, the exact question becomes: how to copy the sel variable above [which
holdes the selected html text] to the clipboard and paste it into the LAST
CURSOR POSITION in the textbox on the Button-Click event handler!!

Thank you so much in advance !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top