One of the useful window properties in the Internet Explorer is the clipboardData property, which holds data copied to the clipboard. We saw how to use this property in "The oncopy Event" in Chapter 6. In that topic, we saw an example using oncopy and onpaste ; when the user copies text from a <SPAN> element, we canceled the normal copy operation (by setting event.returnValue to false) and placed our own text in the clipboard using the setData method. When the user pasted data from the clipboard, we handled that operation ourselves using the getData method. (Listing 06-13.html on the web site)<HTML> <HEAD> <TITLE>Using the Clipboard</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function copy() { window.clipboardData.setData("Text", "Hello from JavaScript!") event.returnValue = false } function paste() { text1.value = window.clipboardData.getData("Text") event.returnValue = false } // --> </SCRIPT> </HEAD> <BODY> <H1>Using the Clipboard</H1> <SPAN oncopy="copy()">Here is some text to copy.</SPAN> <BR> <INPUT ID="text1" onpaste="paste()"> </BODY> </HTML> You can see the results in Chapter 6, in Figure 6.8. For all the details, take a look at "The oncopy Event" in Chapter 6. |