這個只是一個簡單的JavaScript,目的在防止使用者按滑鼠右鍵、複製文章。 不過,當然使用者如果有心的話,還是防不住的。下列就只寫 JavaScript code,不解釋了.. 反正看的懂的就看的懂..看不懂的還是看不懂..
function clickExplorer() { if( document.all ) { //alert('All materials on this site are copyright protected.'); } return false; } function clickOther(e) { if( document.layers || ( document.getElementById && !document.all ) ) { if ( e.which == 2 || e.which == 3 ) { //alert('All materials on this site are copyright protected.'); return false; } } } if( document.layers ) { document.captureEvents( Event.MOUSEDOWN ); document.onmousedown=clickOther; } else { document.onmouseup = clickOther; document.oncontextmenu = clickExplorer; } window.addEvent('domready', function() {document.body.oncopy = function() { //alert('All materials on this site are copyright protected.'); return false;}}); if ( typeof(document.onselectstart) != 'undefined' ) { document.onselectstart = function() { return false }; } document.ondragstart = function(){ return false }
沒有留言:
張貼留言