Selasa, 01 Mei 2012

Cara Disable Highlight Text Dalam Blog

                                 
Selain disable right click, anda juga boleh disable highlight text untuk mengelakkan artikel / entry post anda di copy bulat - bulat dengan mudahnya.

Caranya:

1) Sign in akaun blogger

2) Dashboard > Design > Add A Gadget > Html / Javascript

3) Copy paste kod di bawah pada ruang Html / Javascript 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>

4) Save dan lihat hasilnya

Nota: Untuk kesan disable highlight yang lebih cepat (sebelum habis loading blog) drag Html tadi ke bahagian atas post atau header. Selamat mencuba :)

Sumber:jombinabelog.blogspot.com

0 Coment Budak Comel:

Posting Komentar