첫 번째 유형
<script type = "text/javaScript"> document.body.oncopy = function () {settimeout () {var text = clipboarddata.getData ( "text"); if (text) {text = text + "/r/nthis article은 다음과 같습니다. }, 100)} </script>참고 : 이 코드는 발효되기 전에 신체 영역에 복사해야하며 헤드 영역에 배치 된 경우 작동하지 않습니다.
두 번째 유형
$ ( "body"). bind ( 'copy', function (e) {if (typeof window.getSelection == "undefined") return; // ie8 또는 이전 ... var body_Element = document.getElementsByTagName ( 'body') [0]; var selection = window.getSelection (); // 사용자가 짧은 경우, ( " + selettion in (" + selection); 눈에 띄는 영역의 var var var var 태그 워크 어라운드 // 그렇지 않으면 "pre"는 모든 줄이 나옵니다. <a href = ' " + document.location.href +"'> " + document.location.href +"</a> © mysite.com "; selection.selectallchildren (newDiv); window.settimeout (function () {body_element.RemoveChild (NewDiv);}, 200);요약
위의 것은 편집자가 편집 한 두 가지 방법으로 JavaScript를 사용하여 기사를 복사하기 위해 저작권을 자동으로 추가합니다. 코드는 매우 간단하며 도움이 필요한 친구들이 그것을 참조 할 수 있습니다.