| Forums > Tips & Tricks > "Codes to disable right click and select text are H" (9 replies)
|
|
|
This is the codes to diable select text:
[script language="JavaScript1.2"]
//Disable select-text script (IE4+, NS6+)- By Andy Scott
//Exclusive permission granted to Dynamic Drive to feature script
//Visit www.dynamicdrive.com for this script
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false" )
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
[/script]
Please change all the [square brackets] to the sharp brackets
--------------------------------------------------------------------------------------------------------------------------------
This is to disable right click:
[script type="text/javascript"]
[!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit www.dynamicdrive.com
var message="No clicky";
///////////////////////////////////
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]
Please change all the [square brackets] to the sharp brackets
You may also want to change the words in Bold and Underline
Edited 2.6 years ago. |
| |
|
| |
|
| |
is it true, if yes such nice post thanks. for the sharing.
-------
FriendyAnil
|
| |
| |
|
| |
ok... thanks for posting this..
|
| |
| |
|
| |
thnx for posting! I LOVE these codes
|
| |
| |
|
| |
the disable select text is not working for me...
i went to some of my friend's blog(they got put the code)
but still can select text...
|
| |
| |
|
| |
Very helpful.
Thank you
|
| |
| |
|
| |
FFOX TOO?!
|
| |
| |
|
| |
where shud i apply this.
UNder my css code . or on top my layout codes?
|
| |
| |
|
| |
Thanks so much for sharing , (:
|
| |
| |
|
| |
NOTHING
Edited 2.1 years ago. |
| Subscribe To This Thread: RSS 2.0 or Atom (?) |
| This thread has been locked, and no new replies can be posted. |