Tutorial : Disabled Highlight | Friday, 16 December 2011 | leave me ♥? |
Hello Fellas!
Aku dah wat tutorial pasal Disable Right Click yang kuar Embah aku tu kan.. haha
Ari ni aku nak wat tuto untuk Disabled Highlight pulak.
Disable highlight ni akan membuatkan the COPYCATS tidak boleh kopi mengopi hasil kerja anda yer, anak-anak.. huhuh..
So, first step yang korunk kene wat ialah mcam biase lah kan,
1. Pergi Dashboard >> Design>> Add Gadget>> Html/java script
2. Copy code dibawah.
<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>
3. Kalau dah copy code kat atas tu, korunk boleh la paste kat Html/ java script yer.
4. Then save. Dah siap! Cube try kat blog, mesti dah tak boleh nak highlight lagi.. kekeke~