Friday, 9 November 2012

Disable Text Selection in a page using Javascript


Disable Text Selection in a page using Javascript


Use the following code in the head section of your page(<head></head>):


<script language="JavaScript1.2">

function disableselect(e){

return false

}

function reEnable(){

return true

}

//if IE4+

document.onselectstart=new Function ("return false")

//if NS6

if (window.sidebar){

document.onmousedown=disableselect

document.onclick=reEnable

}

</script>

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top