Doriți să reacționați la acest mesaj? Creați un cont în câteva clickuri sau conectați-vă pentru a continua.



 
AcasaAcasa  Ultimele imaginiUltimele imagini  CăutareCăutare  ÎnregistrareÎnregistrare  ConectareConectare  

 

 Coduri anti copiere

In jos 
AutorMesaj
florynel.
Administrator
Administrator
florynel.


Mesaje Mesaje : 89
Data de inscriere Data de inscriere : 16/09/2010
Varsta Varsta : 145
Localizare Localizare : Cluj

Coduri anti copiere Empty
MesajSubiect: Coduri anti copiere   Coduri anti copiere I_icon_minitimeMier 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>
Sus In jos
https://starfx.forumgratuit.ro
 
Coduri anti copiere
Sus 
Pagina 1 din 1
 Subiecte similare
-
» Diferite coduri

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
 :: Altele :: Tutorials :: Tutoriale HTML-
Mergi direct la: