Hi there all

I am in the process of developing a knowledgebase..

I have some cool click and copy script but it doesnt allow me to format the text that is copied so that I can copy an already fromatted email..

for example:


thank you for contacting us, blablablablablablablablablablabla

Kind regards


here is the jscript I have:

<script language="javascript" type="text/javascript">
function copy_clip(meintext)
 if (window.clipboardData)
  window.clipboardData.setData("Text", meintext);
  else if (window.netscape)
  var clip = Components.classes['@mozilla.org/widget/clipboard;1']
  if (!clip) return;

  var trans = Components.classes['@mozilla.org/widget/transferable;1']
  if (!trans) return;
  var str = new Object();
  var len = new Object();
  var str = Components.classes["@mozilla.org/supports-string;1"]
  var copytext=meintext;
  var clipid=Components.interfaces.nsIClipboard;
  if (!clip) return false;
  alert("The following text has been copied:\n\n" + meintext);
  return false;

<p><span onclick='return copy_clip("this text will be copied to clipboard'>
when you click on this text, the above is copied.(but you cant see it untill you paste it.
</span> </p>

here is my problem.

I cant format any thing in this area

<p><span onclick='return copy_clip("this text will be copied to clipboard'>

I get that jscript error if i try...

I want to for example, do something like this:

<p><span onclick='return copy_clip("hi there,
<p>thank you for contacting us etc</p>")'>

so that when pasted you can have a nicely formatted email/...

Please HELP


First, there is a difference between Jscript and JavaScript. They are two different languages. Second, I don't know of any OS that will copy fully-formatted HTML to the clipboard. Sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.