一、在网页<head>标记间添加如下代码:
<script type="text/javascript">
document.body.oncopy = function nocopy() {
setTimeout( function nocopy() {
var text = clipboardData.getData("text");
if (text) {
text = text + "\r\n本文来自: 编程入门网 "+location.href; clipboardData.setData("text", text);
}
}, 100 )
}
</script>
二、在网页<body>标记中调用上面定义的过程,即:<body oncopy=nocopy()>
时间: 2025-01-01 18:27:13