Just a note:
Copy to Clipboard - Won't work on FF, only in IE. And it will prompt you in IE7.

Originally Posted by
deniseb
so I think I need to do something special for it? like class="codecontainer" - but I don't know what this does?
That's a class. To apply the special highlighting and fancy fonts.
Here's my version to the code (without copy and paste):
Code:
<script type="text/javascript">
function selectAll(id) {
document.getElementById(id).focus();
document.getElementById(id).select();
}
function createLink(id) {
var t=document.createTextNode('Select All');
var a=document.createElement('a');
a.setAttribute("href", "javascript:selectAll('"+id+"')", 0);
a.appendChild(t);
document.body.appendChild(a);
}
function findSelectBoxes() {
var se = document.getElementsByTagName("textarea")
for (i=0;i < se.length;i++) {
var selectAll = se[i].getAttribute("selectAll")
if (selectAll=="") {
createLink(se[i].id)
}
}
}
setTimeout("findSelectBoxes()",100)
</script>
In your textarea, you'll need to specify an ID and put "selectAll" at the end.
Example:
Code:
<textarea name="textarea" id="select" cols="30" rows="5" selectAll></textarea>
It'll create a link for you.
Bookmarks