aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes copying to clipboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "copying to clipboard" Watch "copying to clipboard" New topic
Author

copying to clipboard

Ramesh Patil
Greenhorn

Joined: Aug 09, 2004
Posts: 17
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
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You try this?

Eric
Ramesh Patil
Greenhorn

Joined: Aug 09, 2004
Posts: 17
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<
 
 
subject: copying to clipboard