Javascript: Adding and Appending data to textbox

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Javascript: Adding and Appending data to textbox

Post by tecktalkcm0391 »

This is what I have so far, I want it do add the contents in the clipboard to the textbox

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;
But it does work! Help!!!!
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Can anyone just tell me what to search for cause I've already done searches for:
  • add to textbox javascript
    append to textbox javascript
    and a few other things i don't remember
If someone could point me in the right direction it would be awsome! I'll do the research this time... :wink: pickle
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I don't want to copy the text I want to paste it after whats already there. Everything comming up is for copying.

[Inserted 4:33 PM]:

Ok I found something at http://www.geekpedia.com/tutorial126_Cl ... cript.html but I don't know how to add it to the end of the textbox. Anyone can help?
Post Reply