473,857 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy to ClipBoard problem

Hello,
I apologize for my english, I'm french speaking...

Could someone help me to finalize a little project? I'm writing a form
for my site but I'don't know many in Javascript (I'm a newbee).

When the form is completed, the visitor may display it in another window
for verification, printing or sending by e-mail. When he opens the
second window, the form's content is send automatically to the clipboard
so it could be pasted in another application (Word, etc.).

I demonstrate it in two simple pages.

The first file:
http://cjoint.com/?eynDdWz1d8
is a page showing how it works. When the page is opened, a text
("test10") is pasted in the clipboard. You may verify and paste it in
another application.

The second file is the final projet (simplified for demonstration
purpose):
http://cjoint.com/?eynERRFvDd
I have transferred the working code in this project but the "copy to
clipboard" part doesn't function. If anybody fluent in Javascript could
tell me what is wrong, I would be helped!

--

Cordialement,
Jean-Luc ERNST
Jul 23 '05 #1
3 2147
"Jean-Luc ERNST" <jeanlucpointer nst@advalvaspoi ntbe> wrote in message
news:23******** *************** ****@news.versa tel.nl...
Hello,
I apologize for my english, I'm french speaking...

Could someone help me to finalize a little project? I'm writing a form
for my site but I'don't know many in Javascript (I'm a newbee).

When the form is completed, the visitor may display it in another window
for verification, printing or sending by e-mail. When he opens the
second window, the form's content is send automatically to the clipboard
so it could be pasted in another application (Word, etc.).

I demonstrate it in two simple pages.

The first file:
http://cjoint.com/?eynDdWz1d8
is a page showing how it works. When the page is opened, a text
("test10") is pasted in the clipboard. You may verify and paste it in
another application.

The second file is the final projet (simplified for demonstration
purpose):
http://cjoint.com/?eynERRFvDd
I have transferred the working code in this project but the "copy to
clipboard" part doesn't function. If anybody fluent in Javascript could
tell me what is wrong, I would be helped!

--

Cordialement,
Jean-Luc ERNST


Your function needs to be in the new document.

pop = window.open();
pop.document.wr ite("<html><bod y bgcolor='#FF999 9'
onLoad='documen t.contenu.valeu r.createTextRan ge().execComman d('Copy')'><cen t
er>");
pop.document.wr ite("<form action='' method='post' name='contenu'> <input
type='hidden' name='valeur' value='<p>NAME: " + name + "<p>E-MAIL: " + mail
+ "'></form>");

Jul 23 '05 #2
"McKirahan" <Ne**@McKirahan .com> a écrit dans le message de news:
6I************* *******@comcast .com...
....snip...
Your function needs to be in the new document.

....snip...

Thank you McKirahan,
Do you have tested your suggestion ?
I made the changes you suggested but it doesn't work.
Perhaps something I have forgotten ?

Here my corrected file:
http://cjoint.com/?ezqjgvuCQC
(right-click on the file's name on the page's top and open it in a new
window: the source code will be clean).

Cordialement,
Jean-Luc Ernst
Jul 23 '05 #3
"Jean-Luc ERNST" <jeanlucpointer nst@advalvaspoi ntbe> wrote in message
news:9b******** *************** ****@news.versa tel.nl...
"McKirahan" <Ne**@McKirahan .com> a écrit dans le message de news:
6I************* *******@comcast .com...
...snip...
Your function needs to be in the new document.

...snip...

Thank you McKirahan,
Do you have tested your suggestion ?
I made the changes you suggested but it doesn't work.
Perhaps something I have forgotten ?

Here my corrected file:
http://cjoint.com/?ezqjgvuCQC
(right-click on the file's name on the page's top and open it in a new
window: the source code will be clean).

Cordialement,
Jean-Luc Ernst


I did not test it; when I did I saw that it won't work.

However, the following does; adapt it for your needs.

<html>
<head>
<title>pop.ht m</title>
</head>
<body>
<script type="text/javascript">
var name = "x";
var mail = "y";
var pop = window.open();
pop.document.wr ite("<html>\n") ;
pop.document.wr ite("<body bgcolor='#FF999 9' onLoad='clip()' >\n");
pop.document.wr ite("<form action='' method='post' name='contenu'> \n");
pop.document.wr ite("<input type='hidden' name='valeur' value='<p>NAME:
" + name + "<p>E-MAIL: " + mail + "'>\n");
pop.document.wr ite("</form>\n");
pop.document.wr ite("<" + "script type='text/javascript'>\n" );

pop.document.wr ite("document.c ontenu.valeur.c reateTextRange( ).execCommand(' C
opy');\n");
pop.document.wr ite("alert('Pas te from the clipboard!');\n ");
pop.document.wr ite("</" + "script>\n" );
pop.document.wr ite("</body>\n");
pop.document.wr ite("</html>\n");
</script>
</body>
</html>
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2231
by: Danny J. Lesandrini | last post by:
Has anyone else noticed this? I searched group archives and found nothing, but it's really starting to irritate me big time. Here's the steps to reproduce the problem: Copy something to the clipboard (eg code from a web page) Open Microsoft Access MDB file Open any module Press Ctl-V to insert text Voilia, the text is gone. Opening access dumps the copy buffer.
4
9198
by: Wayne Wengert | last post by:
I have an aspx page on which I am trying to copy the contents of a textbox to the client clipboard when the users clicks a button. The button code is as follows: ===================================== Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopyToClipboard.Click Clipboard.SetDataObject(txtHidden.Text) End Sub
2
3270
by: Shayne H | last post by:
I am trying to write a method to copy some text to the clipboard, and leave a copy of it there after the application has exited. Sub CopyToClipboard(ByVal value As Object) Dim data As New DataObject() data.SetData(DataFormats.UnicodeText, True, value) Clipboard.SetDataObject(data,True) End Sub When I test it, I get an exception:
5
21048
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in windows explorer: when you do a right-click on a file and choose Copy, and than paste it somewhere in my application and vice versa.
2
2690
by: Keith | last post by:
I'm trying to come up with a way to create a contextmenu that will do all the "standard" functions (cut, copy, paste, undo, etc). There seems to be a lot of information out there - but nothing seems to work for me. A few people refer to txt.copy() txt.paste(), etc. I'm not sure if those are old functions, but they do not work for me. I've tried textbox1.selectall() - that works in selecting
7
11654
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
0
2674
by: mhospodarsky | last post by:
Hi-- I am using VB.Net 2002 for this app. I am working with Tiff and jpeg images. I have a picturebox set up that I use to view the images. I have the picture box inside of a scrollable panel.There are two viewing preferences available: to view the image with scrollbars (the original image unsized), and to view the iamge without scrollbars (the image resized to fit within the panel's viewing range.) When I resize the image so that...
8
2623
by: serge calderara | last post by:
Dear all, I have an treeview control with different node object, I would like to implement the Copy/Paste function of an object . For that I am using the folowing function to copy teh object to clipboard : ====> Private Sub CopyToClipboard(ByVal Obj As PluginApp.PlugInReport) ' Creates a new data format.
9
4823
by: Alan T | last post by:
Any source code example I can use to save the clipboard content to an object, then I will do a copy and paste, finally put back the 'saved' clipboard content back to clipboard ?
17
5149
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have about 20 textboxes on the form). Also to ensure that the button can't get used if the cursor isn't in a textbox field. And to ensure the contents of the clipboard are "text" contents that have been cut/copied from one of the textboxes on the form. ...
0
9767
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10711
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10807
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10394
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9549
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7939
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5774
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5967
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.