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):
<head></head>Se eu ajudei, clica "+"
- 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>