This example demonstrates how to use the setData and getData methods with the clipboardData object to perform a cut or paste operation through the shortcut menu.

Steps
  1. If it isn't already selected, select the text in the upper text box ("Select and cut..."). Avoid selecting extra spaces.
  2. Click the selection with the right mouse button and then choose Cut from the shortcut menu, or choose Cut from the Edit menu. The setData method will return a value of true or false in the input box at the bottom of the page.
  3. Select the text "Paste the text here." Click the selection with the right mouse button and then choose Paste from the shortcut menu, or choose Paste from the Edit menu.
Select and cut this text.
Paste the text here.

setData Result:


[Right-click and choose View Source from the shortcut menu.]

© 2007 Microsoft Corporation. All rights reserved. Terms of use.