Javascript: Adding and Appending data to textbox
Posted: Tue Jun 13, 2006 2:48 pm
This is what I have so far, I want it do add the contents in the clipboard to the textbox
But it does work! Help!!!!
Code: Select all
var txtarea = document.forms['xxx'].elements['message'];
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
var clipvalue = execCommand("Paste");
txtarea.value = s1 + clipvalue + s3;
txtarea.selectionStart = s1.length;
txtarea.selectionEnd = s1.length + 5 + s2.length + v.length * 2;