• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

copying to clipboard

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a jsp application where i write data into a html page as it is using <table> . This data is not in a text area or text box. Below is the code.

<tr bgcolor="#FFFFFF">
<div align="Left">
<font face='verdana' size="-1">
<b>
1000 , ABCD ,
</b>
</font>
</div>
</tr>
<tr bgcolor="#FFFFFF">
<div align="Left">
<font face='verdana' size="-1">
<b>
2000 , ABCDE ,
</b>
</font>
</div>
</tr>

The output is shown below.

1000 , ABCD ,
2000 , ABCDE ,

I need to have a button which can select all the above data and copy it to a clipboard which can be pasted in a text file or excel file.

I am not able to select all the data but I am able to copy selected data into a clipboard.
Please help.
Thank you.
Ramesh
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You try this?

Eric
 
Ramesh Y Patil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric. I looked up in google and
this is what I got. This works even if we aren't copying a textarea.



<SPAN ID = "copytext"<
text..........
</SPAN<


<TEXTAREA ID="holdtext" STYLE="display:none;"<
</TEXTAREA<
<BUTTON onCLLL="ClipBoard();"<Copy to Clipboard</BUTTON<




function Clip()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}

<BUTTON onCLL="Clip();"<Copy to Clipboard
</BUTTON<
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic