Saya Mendapatkan script Disable Klik Kanan dengan Javascript ini dari seorang teman dan belum mencobanya. Dia mengatakan It work like a charm.
Saya belum percaya karena belum mencobanya. Katanya sih ditempatkan diantara tag <head> dan penutup head </head>.
<SCRIPT language=JavaScript>
var message="tulis msg anda disini";
///////////////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</SCRIPT>
Silakan Dicoba ya..Saya lemah di JavaScript dan jarang banget menggunakannya.
Update : Ternyata benar benar ampuh nih script. Silakan dicoba ya.. ini contoh filenya, save aja misal test.html. Masalahnya ini untuk di pemrograman sendiri...Untuk di blogger saya tidak tau caranya....Hiks..
hmmm lanjut dulu...
Tus cobain apa klik kanan berhasil dilakukan untuk melakukan copy textnya..Apa bisa dilakukan klik kanan..???
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<SCRIPT language=JavaScript>
var message="tulis msg anda disini";
///////////////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</SCRIPT>
</head>
<body>
aaaaaaaaaaaaaa
</body>
</html>
Tutorial komputer dan Jaringan, Tutorial Sistem Operasi Windows, Tips Pemrograman PHP dan MySQL , Tutorial Virtual Meeting/ Video Conference, Tutorial komputer untuk pemula.
Tampilkan postingan dengan label Javascript. Tampilkan semua postingan
Tampilkan postingan dengan label Javascript. Tampilkan semua postingan
Selasa, 12 Januari 2010
Senin, 19 Oktober 2009
Set Form Element Readonly with Javascript
How we can Set Form Element Readonly with Javascript ..
a piece of the code is here
opener.document.getElementById('jml_aset').setAttribute('readOnly','readOnly');
or the complete forum can be found here
Im affraid any lost.. Maybe copy any source code to this post is good idea...
<script type="text/javascript">
function blah(bool) {
if(bool) {
document.getElementById("ta").readOnly = true;
}
else {
document.getElementById("ta").readOnly = false;
}
}
</script>
<textarea id="ta"></textarea>
<input type="checkbox" onclick="blah(this.checked)" />
or this solution
[1] use setAttribute and removeAttribute
if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.setAttribute('readOnly','readonly'); //2nd readonly more freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.removeAttribute('readOnly');
// also tried document.formOne.fieldtextarea.focus();
}
[2] property assignment
if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=true; //true has some freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=false; //false has some freedom
// also tried document.formOne.fieldtextarea.focus();
}
a piece of the code is here
opener.document.getElementById('jml_aset').setAttribute('readOnly','readOnly');
or the complete forum can be found here
Im affraid any lost.. Maybe copy any source code to this post is good idea...
<script type="text/javascript">
function blah(bool) {
if(bool) {
document.getElementById("ta").readOnly = true;
}
else {
document.getElementById("ta").readOnly = false;
}
}
</script>
<textarea id="ta"></textarea>
<input type="checkbox" onclick="blah(this.checked)" />
or this solution
[1] use setAttribute and removeAttribute
if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.setAttribute('readOnly','readonly'); //2nd readonly more freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.removeAttribute('readOnly');
// also tried document.formOne.fieldtextarea.focus();
}
[2] property assignment
if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=true; //true has some freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=false; //false has some freedom
// also tried document.formOne.fieldtextarea.focus();
}
Langganan:
Komentar (Atom)