I am trying to get it where when you click in the text box it will select all the text and copy it to the clipboard but it only selects the text but does not copy it. Am I missing something or is part of my code wrong.
<input type="text" id="direct-url17" onclick="SelectAll('direct-url17');" value="Text which I am trying to get copied." size="38" onclick="highlight(getElementById('direct-url')); APITrack('copy_details_url');" title="Click to Copy" name="T14"/><font color="#FF0000" size="2"><u>Click in box to copy.<br></u></font>
<span id="copytext" style="height:120;width:200;background-color:teal">
This text will be copied onto the clipboard when you click the button below.
</span>
<textarea id="holdtext" style ="display:none;"></textarea>
<br><br>
<input type = "button" onClick="ClipBoard();" value = "Copy to Clipboard"</button>
<script type = "text/javascript">
function ClipBoard() {
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
window.status="Contents copied to clipboard"
setTimeout("window.status=''",2500)
}
</script>
Thanks for the info. As I see it this security feature is included in IE7 only and prevents programmatic reading from the clipboard, as opposed to writing or copying to it.
The default option is Prompt, but the feature can be completely disabled, or the user can choose to allow programmatic clipboard access to internet trusted zones only.