View Full Version : Select all and copy not working help!

04-26-2008, 08:53 PM
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.

Look below at code.
Please help. Thanks!

<script type="text/javascript">
function SelectAll(id)

<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>


Philip M
04-26-2008, 08:58 PM
<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.

<textarea id="holdtext" style ="display:none;"></textarea>
<input type = "button" onClick="ClipBoard();" value = "Copy to Clipboard"</button>

<script type = "text/javascript">

function ClipBoard() {
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
window.status="Contents copied to clipboard"


04-27-2008, 05:36 AM
FYI: Browsers have a setting to disable copying and reading values from the clipboard.


Philip M
04-27-2008, 08:49 AM
FYI: Browsers have a setting to disable copying and reading values from the clipboard.


I don't find this in IE6. Could you direct me to the appropriate setting?

04-27-2008, 04:11 PM
IE started it in IE7 since reading and writing to the clipboard can be a security risk for those that copy sensitive material to the clipboard.


Philip M
04-27-2008, 04:28 PM
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.