Cut paste copy AND replace buttons !!!
HEY!
i'm new to this forum but just wanted to help
here is a little code i grabbed..it may help better than the one given above...it is all stuck togethere and you won't need to edit anything unless you want to have multiple text areas.
hopea thisa helpsa
Sopy stuff below line!
-------------------------------------------------
<html>
<head>
<script type="text/javascript" language="javascript">
<!--
//-----------------------------------------------------------------------
// author: Vincent Puglia
// site:
http://members.aol.com/grassblad
//-----------------------------------------------------------------------
//-->
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<script>
var IE4 = (document.all) ? true : false;
var text;
function copy(){
var val = document.getElementById('text1').value;
if (IE4)
text = document.selection.createRange().text;
else
text = document.getSelection().createRange().text;
clipboardData.setData('TEXT' , text);
}
function paste(dest)
{
insKarrot(dest, clipboardData.getData('TEXT'))
}
function cut(){
copy();
var target = document.getElementById('text1');
target.value = target.value.replace(clipboardData.getData('TEXT'), '');
}
function storeCaret (obj) {
if (obj.createTextRange)
obj.caretPos = document.selection.createRange().duplicate();
}
function insKarrot (destObj, txt)
{
if (destObj.createTextRange && destObj.caretPos)
{
var caretPos = destObj.caretPos;
caretPos.text =
caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? txt + ' ' : txt;
}
else
destObj.value = txt;
}
</script>
<form>
<textarea rows="10" cols="25" id='text1' onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">
Select any text you wish to copy to the next textarea
</textarea>
<br><br>
<input type="button" value='Cut' onclick="cut()"><br>
<input type="button" value='Copy ' onclick="copy()"><br>
<input type="button" value='Paste ' onclick="paste(this.form.text1)"><br>
<input type="button" value='Replace ' onclick="insKarrot(this.form.text1,clipboardData.getData('TEXT'))"><br></form>
</body>
</html>