npsari
05-03-2007, 12:49 PM
The below script allows text copy in a click of a button:
Try it out, it is nice actually
<script type="text/javascript">
function cmdA(el) {
with(el){
focus();
select();
}
if(document.all){
txt=el.createTextRange()
txt.execCommand("Copy")
window.status='Selected and Copied to Clipboard!'
document.WordForm.cpyButton.value="Copied!";
setTimeout("WordForm.cpyButton.value='Copy'",1000)
}
else window.status='Press Ctrl-C to Copy the Text to the Clipboard'
setTimeout("window.status='WebTv users you must Press Cmd & C !'",3000)
}
</script>
<form name="WordForm" >
<input type="text" id="Editbox1" size="30" name="Screen" value="This text should be copied">
<input type="button" width="120" NAME="cpyButton" value="Copy" onClick="cmdA(document.WordForm.Screen)">
However, when the button is clicked, another button shows with the word copied!
Can someone show me how can the script display an image (/images/copied.gif) instead of the button.
Your support is appreciated
npsari
Try it out, it is nice actually
<script type="text/javascript">
function cmdA(el) {
with(el){
focus();
select();
}
if(document.all){
txt=el.createTextRange()
txt.execCommand("Copy")
window.status='Selected and Copied to Clipboard!'
document.WordForm.cpyButton.value="Copied!";
setTimeout("WordForm.cpyButton.value='Copy'",1000)
}
else window.status='Press Ctrl-C to Copy the Text to the Clipboard'
setTimeout("window.status='WebTv users you must Press Cmd & C !'",3000)
}
</script>
<form name="WordForm" >
<input type="text" id="Editbox1" size="30" name="Screen" value="This text should be copied">
<input type="button" width="120" NAME="cpyButton" value="Copy" onClick="cmdA(document.WordForm.Screen)">
However, when the button is clicked, another button shows with the word copied!
Can someone show me how can the script display an image (/images/copied.gif) instead of the button.
Your support is appreciated
npsari