Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

PHP

Hi Guys
Hope you can help.

What Id like to do is the following:

------------------------------------------------------------------------------- Web Page

===================================== Code Snippet1
Code in here.....
Code in here.....
Code in here.....
Code in here.....
-------------------------------------------------------- End of code
<Copy Code Button>
===================================== Code Snippet2
Code in here.....
Code in here.....
Code in here.....
Code in here.....
-------------------------------------------------------- End of code
<Copy Code Button>
===================================== Code Snippet3
Code in here.....
Code in here.....
Code in here.....
Code in here.....
-------------------------------------------------------- End of code
<Copy Code Button>


=============================================== End of web page.

All Im trying to do, is to:

Create a CopyCode Button that:

1) Selects automatically all the code in the text box, to the clipboard
2) Able to have as many CopyCode Buttons on the page as you want, which reference whatever text box the Code is in.

As Im using PHP/HTML, this would be the preferred scripting method.

Thanks guys in advance.
0
Simon336697
Asked:
Simon336697
1 Solution
 
thomaswrightCommented:
PHP is a server-side scripting language.  The clipboard resides on the client's machine.  You would need to use a client-side scripting language like javascript in order to copy data to the client's clipboard.
0
 
Simon336697Author Commented:
Hi thomaswright!
Mate you are dead right.
Ill post this again in the javascript section.
0
 
soitronCommented:
Hi Simon,

I use this feature of JAVASCRIPT many years.
You can search the Internet and find the solution, i.e. http://www.htmlgoodies.com/beyond/javascript/article.php/3458851

It may helps :-)

Frank
0
 
Rok-KraljCommented:
In firefox 2.0, access to the register is blocked.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now