복사할 문장
복사
==========================================
<p>
<span id="myInput" style="display:inline-block">복사할 문장</span>
<span style="display:inline-block;border:1px solid #ddd;cursor:pointer;font-size:0.8em;padding:2px 5px 2px 5px" onclick="copy_to_clipboard()"> 복사</span>
</p>
<script>
function copy_to_clipboard() {
var copyText = document.getElementById("myInput").innerText;
var t = document.createElement("textarea");
document.body.appendChild(t);
t.value = copyText;
t.select();
document.execCommand('copy');
document.body.removeChild(t);
alert(copyText + " 가 클립보드에 복사되었습니다. ")
}
</script>
============================================