Javascript copy to clipboard only gets the first record
<p>I have a button that is generated for each record from a search.
The buttons function is to copy the file number of that record to the clipboard, however no matter which button is clicked it only copies the first records file number?</p>

<pre><code>&lt;imgage alt="Copy File No. &lt;%=ShowFileNo%&gt;&lt;delim&gt; to clipboard" name="&lt;%=ShowFileNo%&gt;" src="Style/Copy2.png" onclick="copy('CopyImage');" id="CopyImage" /&gt;
</code></pre>

<hr>

<pre><code>function copy(controlId) {
  var control = document.getElementById(controlId);
  if (control) {
    var controlValue = control.name + '&lt;delim&gt;';
    window.clipboardData.setData('Text', controlValue);
    alert("'" + controlValue + "'" + ' copied to clipboard')
    window.close();
  }
}
</code></pre>

<p>Thanks
Darren</p>
