Javascript: Impedir la selección de texto en una página Web

Octubre 30th, 2007 by kenavik

Os dejo un fragmento de código Javascript con el que podemos impedir la selección de texto en una página Web.

Esta código funciona correctamente en Internet Explorer y FIREFOX

<script>
document.onselectstart=function(){return false};
if (window.sidebar){
document.onmousedown=function(e){
var obj=e.target;
if (obj.tagName==”INPUT”){
return true;
}else if (obj.tagName==”BUTTON”){
return true;
}
return false;
}
}
</script>

Posted in Javascript |

Escribir un comentario

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.