Script Anti seleção

2 participantes

TioCentos TioCentos  • 13.03.13 14:07

Script Anti seleção Empty Script Anti seleção 13.03.13 14:07

Esse é o Script que bloqueia seleção na pagina. Para funcionar, adicione o código entre as tags citadas abaixo
Tags (Clique):
Código:
<script>
var tagsAbertas =["input", "textarea", "select", "div"]; // CAMPOS QUE NAO SERAM BLOQUEADOS
tagsAbertas = tagsAbertas.join("|");

function fechaCamposFF(e){
var elemento = (e.target)?e.target:e.srcElement;
  if (tagsAbertas.indexOf(elemento.tagName.toLowerCase())==-1)
      return false;
}

function abreCamposFF(){
return true
}

function fechaCamposIE(){
var elemento = event.srcElement;
  if(tagsAbertas.indexOf(elemento.tagName.toLowerCase()) == -1)
      document.onselectstart = new Function ("return false");
}

function abreCamposIE(){
var elemento = event.srcElement;
  if(tagsAbertas.indexOf(elemento.tagName.toLowerCase()) == -1){
      document.onselectstart = new Function ("return false");
  }else{
      document.onselectstart = new Function ("return true");
  }
}

if (typeof document.onselectstart != "undefined"){
document.onmousedown  =  fechaCamposIE;
document.onmouseup      =  abreCamposIE;
document.onselectstart  = new Function ("return false");
}else{
document.onmousedown  =  fechaCamposFF;
document.onmouseup      =  abreCamposFF;
}
</script>
Se eu ajudei, clica "+"

Incrats Incrats  • 17.03.13 4:25

Script Anti seleção Empty Re: Script Anti seleção 17.03.13 4:25

Muito bom o tutorial. Obrigado por compartilhar
Permissões neste sub-fórum
Não podes responder a tópicos

BH Servers

Recomendamos a BH Servers com proteção DDOS gratuita em Cloud Server de alta performance. Entrega imediata.