(그누보드) 주소 복사하기 버(복사 확인 메시지에 복사된 링크 표시하기)
본문
skin/board/basic/view.skin.php 라면
<button type="button" class=“btn btn_b03" style="width:120px;height:50px;font-size:2.0rem;background-color:#0000;border-radius:10px"><a href="#" onclick="clip(); return false;">
<i class="fa fa-share" aria-hidden="true">
<script type="text/javascript">
function clip(){
var url = '';
var textarea = document.createElement("textarea");
document.body.appendChild(textarea);
url = window.document.location.href;
textarea.value = url;
textarea.select();
document.execCommand("copy");
alert('복사 성공! ' + ‘복사된 링크’ + window.location.href)
}
</script>
</li>
</button>
mobile/skin/board/basic/view.skin.php 라면
<button type="button" class=“btn_scrap"><a href="#" onclick="clip(); return false;">
<i class="fa fa-share" aria-hidden="true">
<script type="text/javascript">
function clip(){
var url = '';
var textarea = document.createElement("textarea");
document.body.appendChild(textarea);
url = window.document.location.href;
textarea.value = url;
textarea.select();
document.execCommand("copy");
alert('복사 성공! ' + window.location.href)
}
</script>
</li>
</button>
위와 같이 사용할 수 있고, class를 btn_scrap 이나 btn btn_b03으로 사용한다면 따로 CSS를 추가하지 않아도 이쁘게 사용이 가능하다.
좋아요103
이 글을 좋아요하셨습니다
2kat님의 댓글
좋은 하루 되세요