Yaitu kode JS:
Salinan kode adalah sebagai berikut:
<type skrip = "Teks/JavaScript">
fungsi copyUrl2 ()
{
var url2 = document.geteLementById ("biao1");
Url2.select (); // pilih objek
document.execCommand ("copy");
peringatan ("Salin, dapat ditempelkan.");
}
</script>
<textarea cols = "20" baris = "10" id = "biao1"> Area kode yang ditentukan pengguna </textarea>
<input type = "tombol" ontClick = "copyUrl2 ()" value = "Klik untuk menyalin kode" />
Kode JS Chrome:
Salinan kode adalah sebagai berikut:
<Script src = "http://www.weicaiyun.com/assets/js/copy/zeroclipboard.js"> </script>
<type skrip = "Teks/JavaScript">
var clip = new ZeroClipboard.client ();
clip.setHandCursor (true);
clip.setText ('Salin konten');
clip.glue ('tombol');
</script>
<input type = "tombol" id = "tombol" value = "Klik untuk menyalin kode" />