JavaScript Reference/Javascript Methods/clearData

Материал из Web эксперт
Перейти к: навигация, поиск

"clearData()" Example

    
<html>
<body>
<button onclick="clipboardData.setData("Text",document.selection.createRange().text);">
Copy
</button>
<button onclick="myText.value = clipboardData.getData("Text");">Paste</button>
<button onclick="clipboardData.clearData("Text");">Clear clipboard</button>
<p>This is some sample text for you to copy.</p>
<textarea id="myText" style="width:600; height:100"></textarea>
</body>
</html>



"clearData()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |clipboardData                   dataTransfer                  |
+----------------+--------------------------------------------------------------+



"clearData()" Syntax, Parameters and Note

Note:
Clears the clipboard.
    
Syntax:
    
event.objectName.clearData(param1)

Parameters:
    param1   Optional; one or more of the following data formats: 
                       Text, URL, File, HTML, and Image. 
                       Leave blank to clear all data formats.