JavaScript
HTML | JavaScript | CSS |
Copy to Clipboard
function copytoclip() { document.getElementById("terza").style.display = "block"; selectText("terza"); document.execCommand("Copy"); document.getElementById("terza").style.display = "none"; } function selectText(containerid) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(document.getElementById(containerid)); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(document.getElementById(containerid)); window.getSelection().addRange(range); } } Es di codice chiamante: <input type="submit" value="Copy" onclick="copytoclip()"> **N.B.** Parametrizzare "terza"
page revision: 1, last edited: 07 Jun 2017 07:43