First of all this is sort of a silly thing to do. If the user wants the text, they can use their browser's "View Source" and copy it from there or disable javascript and select the text in the normal fashion.
But in Opera you can try:
Code:
<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(e){if(e && e.target && e.target.tagName){if(/^(input|select)$/i.test(e.target.tagName)){return true;}}return false;}
target.style.cursor = "default"
}
</script>
The browser cache may need to be cleared and/or the page refreshed to see changes.
No guarantee. But it might work. Otherwise, just let Opera users slide:
Code:
<script type="text/javascript">
function disableSelection(target){
if(window.opera){return;}
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"
}
Bookmarks