View Single Post
Old 12-10-2012, 03:23 PM   PM User | #1
tunayx
New Coder

 
Join Date: Apr 2007
Posts: 60
Thanks: 3
Thanked 0 Times in 0 Posts
tunayx is an unknown quantity at this point
Text selection disable & Opera Browser

While the scipt works fine on all browsers except Opera Browser. Input fields and drop down menu becomes unclickable, how to fix it?

My example page:

http://www.aymavisi.org/makale/Evlil...20Gibran).html

Head:

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(){return false}
target.style.cursor = "default"
}
</script>

Body:


Code:
<script type="text/javascript">
disableSelection(document.body) 
</script>

<script type="text/javascript">
var somediv=document.getElementById("layer1")
disableSelection(somediv) 
</script>
P.S
You can choose install Opera as portable in installation options.

Last edited by tunayx; 12-10-2012 at 04:48 PM..
tunayx is offline   Reply With Quote