clipboardData Object

DHTML, HTML, & CSS

clipboardData Object


Provides access to predefined clipboard formats for use in editing operations.

Remarks

The clipboardData object is reserved for editing actions performed through the Edit menu, shortcut menu, and shortcut keys. It transfers information using the system clipboard and retains it until data from the next editing operation supplants it. This form of data transfer is particularly suited to multiple pastes of the same data.

This object is available in script as of Microsoft® Internet Explorer 5.

Members

Example

This example uses the setData and getData methods with the clipboardData object to perform a cut-and-paste operation through the shortcut menu.

Sample Code

<SCRIPT>
// Selects the text that is to be cut. Trailing spaces in a text
// selection in cut events causes the cut shortcut menu item to
// remain disabled.
function fnLoad() {
    var r = document.body.createTextRange();
    r.findText(oSource.innerText);
    r.select();
}

// Enables the Cut shortcut menu item, which is disabled by default over a DIV
function fnBeforeCut() {
    event.returnValue = false;
}

// Enables the Paste shortcut menu item, which is also disabled by default over a DIV
function fnBeforePaste() {
    event.returnValue = false;
}

</SCRIPT>
</HEAD>
<BODY>

<DIV ID="oSource" onbeforecut="fnBeforeCut()" >
    Cut this Text
</DIV>

<DIV ID="oTarget" TYPE="text" VALUE="Paste the Text Here"
       onbeforepaste="fnBeforePaste()"><DIV>
</BODY>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
window

See Also

data transfer overviewInternet Link


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.