♥tutorial : disable text selection

salam..
tutorial kali  ni lya nk ajar korang cara2 nk buat
'DISABLE TEXT SELECTION'
ni cara terbaik tok elak copycatzz la..
lau lya buat ni kang camne plak korang nk copy kod kat blog lya kn?
so lya x wat katblog lya..
sape2 yg nk..jom kite start..

1.ok murid2 sekalian.. (prasan cikgu) mcm bese lowh ye..
dashboard > design > page element > add gadget > html
2.copy n paste kod kat bwh ni ye..


<script type="text/javascript">/************************************************ Disable Text Selection script- &#169; Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code***********************************************/
function disableSelection(target){if (typeof target.onselectstart!="undefined") //IE routetarget.onselectstart=function(){return false}else if (typeof target.style.MozUserSelect!="undefined") //Firefox routetarget.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>



~da paste save saje la..ape ssh..senang kn3? then g tgk kat blog korang n try highlight ape je la..confirm x boley kn3? maknenye da jadi la 2..slmt mencube :D


No comments: