florynel. Administrator
Mesaje : 89 Data de inscriere : 16/09/2010 Varsta : 145 Localizare : Cluj
| Subiect: Coduri anti copiere Mier Sept 29, 2010 4:10 pm | |
| Dezactiveaza click dreapta in totalitate: - Cod:
-
<script language=JavaScript> <!--
var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false") // --> </script> Dezactiveaza click dreapta pe imagine: - Cod:
-
<script language="JavaScript1.2">
var clickmessage="Right click disabled on images!"
function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } }
function associateimages(){ for(i=0;i<document.images.length;i++) document.images[i].onmousedown=disableclick; }
if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() </script> Dezactiveaza selectarea textului: - Cod:
-
<script type="text/javascript">
function disableSelection(target){ if (typeof target.onselectstart!="undefined") //IE route target.onselectstart=function(){return false} else if (typeof target.style.MozUserSelect!="undefined") //Firefox route target.style.MozUserSelect="none" else //All other route (ie: Opera) target.onmousedown=function(){return false} target.style.cursor = "default" }
//Sample usages //disableSelection(document.body) //Disable text selection on entire body //disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
</script> | |
|