最初のタイプ
<script type = "text/javascript"> document.bodey.oncopy = function(){setimeout(){var text = clipboarddata.getData( "text"); if(text){(text){(text){text = text + "/r/nthis記事は次のとおりです。 }}、100)} </script>注:このコードは、有効になる前にボディ領域にコピーする必要があり、ヘッドエリアに配置しても機能しません。
2番目のタイプ
$( "body")。bind( 'copy'、function(e){if(typeof windof.getSelection == "未定義")return;目に見える領域は、選択したテキスト= document.createlement( 'div'); <pre> tag workaround //「pre」内のテキストは、すべてのラインブレークを失います/>続きを読む:<a href = '" + document.location.href +"'> " + document.location.href +" </a>©mysite.com "; selection.selectallchildren(newdiv); window.settimeout(function(){body_element.removechild(newd);}、200);要約します
上記は、JavaScriptを使用して著作権を自動的に追加して記事をコピーするために、編集者によって編集された2つの方法です。コードは非常にシンプルで、困っている友人はそれを参照できます。