Copy To Clipboard Using JavaScript With No Flash
This code snippet will create a button which on clicked will open prompt on the web browser using which you can copy the given value to the function. This is a simple implementation of JavaScript Prompt(). You can now from the prompt copy the passed data simply by pressing ctrl+c from your keyboard. This code snippet can be used in php for passing dynamic data to the function which can be displayed in the prompt so that copying is easy. From the Web you can find a lot many ways to directly copy from clipboard but those use flash. This code snipped dont use any flash content !
Screenshots:
The Code Snippet:
Description:
The first parameter of the prompt() is the title or heading of the prompt and the second one is the input box which displays the passed data to the function !
If you found the code helpful, take a moment to share it ! :)
Screenshots:
This Java Script code snippet working with PHP files
This Java Script code snippet working with HTML files
The Code Snippet:
<script> function ctc(user,pass) { window.prompt("Copy to clipboard: Ctrl+C, Enter", "username: "+user+", password: "+pass); } </script> <button name="test" value="click" onClick=ctc("bla","bPas")>bla bla</button>
Description:
The first parameter of the prompt() is the title or heading of the prompt and the second one is the input box which displays the passed data to the function !
If you found the code helpful, take a moment to share it ! :)
Comments
Post a Comment