Cara pertama: Cuma disable right-click ja, tapi still boleh highlight dan copy pakai ctrl+c
- Pegi kat layout, klik dekat EDIT HTML
- Pastu klik dekat 'expand template widget'
- Tekan ctrl+f, pastu paste kod ni <body>. Dah jumpa, korang ubah jadi: <body oncontextmenu="return false;">
- Pastu save template.
Cara kedua: Yang ni keluar pop-up window punya. Macam hebat pulak.
- Pegi 'page element'.
- Pastu klik 'add gadget'. Then, korang klik dekat html/javascript dan korang tampallah kod kat bawah ni.
<script language='JavaScript'>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Tak payah dok gatai"
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Tak payah dok gatai"
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
*Tulisan yang kaler biru tu, ikut sukahati koranglah nak letak apapun. Contohnya macam: 'Hoi, buat apa tu? Lempang mau?'.
Cara ketiga: Ni yang paling kedekut tak hengat. Highlight tak boleh, copy lagila tak boleh.
- Pegi kat layout
- Cari kod ni ~<head>
- Paste kod bawah ni, atas <head>
script type="text/javascript">
//form tags to omit in NS6+:
//http://eking.in
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
//form tags to omit in NS6+:
//http://eking.in
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
Juan: Kalau blog yeng jenis tutorial, takyah la pakai cara no.3. Nanti orang nak copy kod susah. Pastu diorang pangkah terus blog korang
Tiada ulasan:
Catat Ulasan