The following modified script will copy the values of multiple textareas into clipboard, though currently in IE only:
Code:
<script language="Javascript">
<!--
/*
Select and Copy form element script- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/
function HighlightAll(theField) {
if (typeof theField=="string")
theField=[theField]
if (document.all){
var combinedvalues=""
for (var i=0; i<theField.length; i++)
combinedvalues+=eval("document." + theField[i]).value
var temptextarea=document.createElement("textarea")
temptextarea.style.display="none"
temptextarea.value=combinedvalues
document.body.appendChild(temptextarea)
temptextarea.createTextRange().execCommand("Copy")
}
}
//-->
</script>
<body>
<form name="test">
<a class="highlighttext" href="javascript:HighlightAll(['test.select1', 'test.select2'])">Select All</a><br>
<textarea name="select1" rows=10 cols=35 >FIRST textarea value</textarea>
<textarea name="select2" rows=10 cols=35 >SECOND textarea value</textarea>
</form>
When calling the HighlightAll() function, pass into it an array of strings representing the names of the textareas, for example:
Code:
HighlightAll(['test.select1', 'test.select2'])
Bookmarks