Where "DataFormat" may be either "Text" or "URL". If it is "Text" then it gets the data formatted as text and if it is "URL" then it gets the data formatted as a URL.
Description of code:
In our example code we have created two functions for copying data and pasting data to the described text area. These two functions copyData() and pasteData() is called when user clicks on the buttons Copy and Paste. Before copying data we need to select the data otherwise in the clipboardData object "null" value would be set and it will be further pasted to the text area. Here is the following html example code for getDataExample method as follows :
txtArea.value = clipboardData.getData('Text');
<div style="background: #ff9900; width:'100%';" align="center">
<font color="#0000ff" size="12pt">
<b>Get Data Example</b>
<div style="background: #0099ff; width:'100%';" align="center">
<p>Rose India Technologies Pvt. Ltd. is a global services company that ensures maximum returns by providing quality software solutions and services. The Indian based company provides services to several reputed institutional clients, in the domain of IT and IT enabled Technologies. We help in understanding the client requirements and offer customized solutions in various specialized areas like Web based Technologies, Database Systems, Client Server Architecture, E-commerce Solutions and Consultancy Services</p>
<textarea id="txtArea" style="width:600; height:100; background:#ffffcc;">
Paste your text here....
Select the data to which you want to copy.
Click on the Copy button to get data which is selected by you and now click on the Paste button to paste the copied text data to the text area.
You can also download the full source code from the provided link as given below.
Posted on: January 29, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles