PDA

View Full Version : Disable right click on picture or blog skin



lolfoollor
02-27-2011, 02:01 AM
1) Script Title: http://www.dynamicdrive.com/dynamicindex9/noright.htm

2) Script URL (on DD): <script type="text/javascript">
<!--

/*
Disable right mouse click Script (By Crash @ http://walk.to/crash)
Submitted to and permission granted to Dynamicdrive.com to feature script in it's archive
For full source code to this script and 100's more, visit
http://dynamicdrive.com
*/

var message="Function Disabled";
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</script>

3) Describe problem: TY to Djr33 i can finally pose alot of codes But ... it does still does not work

traq
02-27-2011, 03:01 AM
this is javascript, not xml (or html, etc.).
it will not validate as XML (etc.), and shouldn't be expected to.

if you need your page to pass validation, place the script in an external file instead of inline in the document.

djr33
02-27-2011, 03:05 AM
Also, replace this:
<script language=JavaScript>
With the current standard:
<script type="text/javascript">
(Adding the src="path/to/file.js" will work for either, as traq suggested.)


I guess that is a bug in the original script. Additionally, it doesn't do anything in Firefox 3 for OSX.

In general, it is highly discouraged to attempt to modify browser behavior because it is not secure (hackers and others who are intentionally stealing or otherwise hurting your site can get around it) and it will usually cause problems for others.

lolfoollor
02-27-2011, 03:15 AM
ty guys