2

the following is the code. but it doesn't work. what's wrong with it? thank you.

      <head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>no title</title>
   <script type="text/javascript">
      function copyToClipBoard(content){
 var clipBoardContent = ''; 
clipBoardContent = content;
 window.clipboardData.setData("Text",clipBoardContent);
 alert('have copied to the clipboard');
}

 <body>
<textarea rows="4" cols="60" id="url">www.example.com</textarea>
     <input type="button" value="click me" onclick="copyToClibBoard (document.getElementById   ('url').value);" />

</body>
runeveryday
  • 2,511
  • 4
  • 26
  • 43
  • 4
    `onclick="copyToClibBoard` should be `onclick="copyToClipBoard` – jon3laze Dec 31 '10 at 02:31
  • hi you might want to [refer on this past discussion](http://stackoverflow.com/questions/400212/how-to-copy-to-clipboard-in-javascript) thanks – melaos Dec 31 '10 at 03:17

1 Answers1

0

You cannot do this in Javascript.

Instead, you need to use Flash.

SLaks
  • 800,742
  • 167
  • 1,811
  • 1,896