473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2105
"Jean-Luc ERNST" <jeanlucpointernst@advalvaspointbe> wrote in message
news:23***************************@news.versatel.n l...
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.write("<html><body bgcolor='#FF9999'
onLoad='document.contenu.valeur.createTextRange(). execCommand('Copy')'><cent
er>");
pop.document.write("<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" <jeanlucpointernst@advalvaspointbe> wrote in message
news:9b***************************@news.versatel.n l...
"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.htm</title>
</head>
<body>
<script type="text/javascript">
var name = "x";
var mail = "y";
var pop = window.open();
pop.document.write("<html>\n");
pop.document.write("<body bgcolor='#FF9999' onLoad='clip()'>\n");
pop.document.write("<form action='' method='post' name='contenu'>\n");
pop.document.write("<input type='hidden' name='valeur' value='<p>NAME:
" + name + "<p>E-MAIL: " + mail + "'>\n");
pop.document.write("</form>\n");
pop.document.write("<" + "script type='text/javascript'>\n");

pop.document.write("document.contenu.valeur.create TextRange().execCommand('C
opy');\n");
pop.document.write("alert('Paste from the clipboard!');\n");
pop.document.write("</" + "script>\n");
pop.document.write("</body>\n");
pop.document.write("</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
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...
4
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:...
2
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...
5
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...
2
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...
7
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...
0
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...
8
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...
9
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.