Faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

60 of 144 people (42%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I access the general windows clipboard in both IEand netscape using javascript

Apr 5th, 2008 19:05
ha mo, Knud van Eeden, Colin Fraser, padmaja,


First things first, go and have a look in the Dark Side:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/clipbo
ardData.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setDat
a.asp
These two references will give you some information about getting data
to the clipboard and how to deal with it when you have got it there.
but the short answer is :
To copy the text to the clipboard:
vname1 = window.clipboardData.setData( "Text", "The time has come the 
walrus said" );
To paste use something like:
vname2 = window.clipboardData.getData("Text");
document.write( vname2 );
---
For example:
<HTML>
<SCRIPT>
vname1 = window.clipboardData.setData( "Text", "The time has come the 
walrus said" );
vname2 = window.clipboardData.getData("Text");
document.write( vname2 );
</SCRIPT>
</HTML>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com