PDA

View Full Version : clipboard script to copy the form contents



sadakathullah
12-31-2009, 08:15 AM
hi I am developing a small tool for my college project and i need help. I have designed a website for my college and it has a form with text boxes, option buttons and combo boxes. i need to write a script that copies every content of the form to clipboard without changing the format so i can paste the same contents in notepard or word.

jscheuer1
12-31-2009, 01:38 PM
I believe that's still IE only (though the execCommand method is supported by others, it's options don't include 'copy' in those others as far as I know), see:

http://msdn.microsoft.com/en-us/library/ms536419(VS.85).aspx

and:

http://msdn.microsoft.com/en-us/library/ms533049(VS.85).aspx

You may also need information on making a selection range:

http://msdn.microsoft.com/en-us/library/ms536401(VS.85).aspx

and:

http://msdn.microsoft.com/en-us/library/ms535872(VS.85).aspx

That should get you the info you need for copying. However, preserving format, well that cannot even be done in many cases when using the mouse and the browser menu to do the copying to the clipboard part. Though often, and this depends to a degree upon what was selected, copying and pasting to Word from a web page will automatically preserve some of the elements of formatting. NotePad however is a plain text only editor and will never preserve formatting of any kind other than where lines wrap on CRLF character pairs.

Note: All of the above links to the Microsoft Developer Network include links to other articles within the network that may also be of interest/required in this project.

sadakathullah
01-01-2010, 07:33 AM
thanks for the info i will try these out... - Sadakathullah