https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_copy_clipboard ' Fare clic sul pulsante per copiare il testo dal campo di testo. Prova a incollare il testo (ad esempio ctrl + v) in seguito in una finestra diversa per vedere l'effetto. <!DOCTYPE html> <html> <body> <p>Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.</p> <input type="text" value="Hello World" id="myInput"> <button onclick="myFunction()">Copy text</button> <p>The document.execCommand() method is not supported in IE8 and earlier.</p> <script> function myFunction() { var copyText = document.getElementById("myInput"); copyText.select(); document.execCommand("copy"); alert("Copied the text: " + copyText.value); } </script> </body> </html> |