Can you copy to the clipboard with JavaScript? - Can you copy to the clipboard with JavaScript?

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

JavaScript can't write to a file (other than a cookie, or the file it is in).

I'm not quite sure what you are asking, what variable details are you trying to save- and what do you want to post in other documents? Parts of code?

Maybe someone here has some other ideas for you. Smiling

----------
John Pollock
http://www.pageresource.com

They have: 5,633 posts

Joined: Jan 1970

What I would like to do is store variable details on the clipboard so I can paste them into other documents.

Can this be done?

They have: 5,633 posts

Joined: Jan 1970

What I want to do is have a button using JavaScript that can imitate pressing CTRL C. This would be very handy because I am creating a cut & paste collection of scripts/html/dhtml code.

This is what I want it to do:-
1..Have a text form field
2.Add an entry to it
3.Press a button and copy the form field value directly to the clipboard.

Maybe this can be done using DHTML?

I would also like to know if you can have JavaScript launch the FIND utility. eg. so you dont have to press CTRL F.

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

I don't think you can do those, but you can have a "select all" button. I've seen that at Dynamic Drive- hopefully they are still using it. Go to:

http://www.dynamicdrive.com

If you get the code for a script, there should be a select all button you can click to select the text in the textarea.

Not quite what you are after, but a step in that direction. Smiling

----------
John Pollock
http://www.pageresource.com

They have: 5,633 posts

Joined: Jan 1970

Thanks for your response John. I have been to www.dynamicdrive.com previously but since then I see they have added a lot of content to their site. I have found the SELECT ALL script and I'm sure this will be of some help to me.

----------
[email protected]
vegas.com.au/~jasper

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.