Try it out, it is nice actually
Not really... it uses a lot of bad coding practices. Try this (should be a drop-in replacement for the above function):
Code:
<script type="text/javascript">
function cmdA(el) {
var txt,
b = document.forms['WordForm'].elements['cpyButton'],
g = document.images['cpyImage'];
if(!g) {
g = document.createElement("img");
g.id = "cpyImage";
g.src = "/images/copied.gif";
g.style.display = "none";
b.parentNode.insertBefore(document.createElement("img"), b);
}
el.focus();
el.select();
if(
txt = el.createTextRange &&
txt = txt() &&
txt = txt.execCommand &&
txt("Copy")
) {
b.style.display = "none";
g.style.display = "";
setTimeout(
(function(b, g) {
return function() {
b.display = "";
g.display = "none";
b = g = null;
};
)(b.style, g.style),
1000
);
} else {
b.style.display = "none";
b.parentNode.insertBefore(document.createTextNode("Unable to copy. Please press Ctrl+C, Cmd+C, or your system's shortcut."), b);
b.parentNode.removeChild(b);
}
txt = b = g = null;
}
</script>
Bookmarks