TUTORIAL : DISABLE HIGHLIGHT


Montela pernah ajar Disable Right Click kan?
Oke, now kite belajar macam mana nak Disable Highlight pulak.
Means orang tak boleh highlight apa pun dari blog kita :)

1. Dashboard > Design > Add New Gadget > HTML / Java Script

2. Copy dan Paste kod kat bawah nih dalam HTML / Java Script tadi.

<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"
}
//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
</script>
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script> 

Oke, done! Save, dan uols try la oke!

Tiada ulasan:

DISCLAIMER: Comments are welcomed. However, noted that, tasteless and insulting comments may be deleted. Any personal remarks and attacks may be deleted. The same holds true for off-topic comment. Any comments that reek of link spam or marketing messages will be deleted.

I am not responsible for the content in comments other than those made by me, or in blogs, or other online content that I may link to.

Dikuasakan oleh Blogger.