k

[복사하기] 버튼 자료~

· 2012-12-20 (목) 16:18:44 · 2715

<script>
 function copyClip(clip) {
    copyOption = document.body.createTextRange();
    copyOption.moveToElementText(clip)
    copyOption.execCommand('copy');
    alert('복사되었습니다.');
 }
 </script>
 

<button style="cursor:pointer" onclick=copyClip(clip1)>1번복사물</button>
 <div id=clip1 style="display:none">대한민국</div>
 <button style="cursor:pointer" onclick=copyClip(clip2)>2번복사물</button>
 <div id=clip2 style="display:none">축구</div>
 <button style="cursor:pointer" onclick=copyClip(clip3)>3번복사물</button>
 <div id=clip3 style="display:none">국가대표</div>
 <button style="cursor:pointer" onclick=copyClip(clip4)>4번복사물</button>
 <div id=clip4 style="display:none">감독</div>
 <button style="cursor:pointer" onclick=copyClip(clip5)>5번복사물</button>
 <div id=clip5 style="display:none">조광래</div>

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
MySQL 12-12-30 조회 6,853
웹서버 12-12-30 조회 1.9만
Mobile 12-12-29 조회 4,799
PHP 12-12-28 조회 6,025
PHP 12-12-28 조회 5,429
PHP 12-12-28 조회 2,754
jQuery 12-12-27 조회 3,925
jQuery 12-12-27 조회 3,190
JavaScript 12-12-27 조회 3,678
PHP 12-12-27 조회 2,692
PHP 12-12-27 조회 4,103
jQuery 12-12-27 조회 1만
웹서버 12-12-26 조회 5,264
PHP 12-12-20 조회 5,366
JavaScript 12-12-20 조회 1.7만
JavaScript 12-12-20 조회 2,716
PHP 12-12-18 조회 9,285
jQuery 12-12-18 조회 2,864
OS 12-12-15 조회 6,050
OS 12-12-15 조회 7,367
웹서버 12-12-15 조회 7,995
PHP 12-12-14 조회 4,775
OS 12-12-12 조회 4,622
OS 12-12-12 조회 8,562
jQuery 12-12-12 조회 3,633
jQuery 12-12-12 조회 7,630
jQuery 12-12-12 조회 9,487
PHP 12-12-10 조회 2,430
PHP 12-12-10 조회 2,499
OS 12-12-10 조회 6,134