<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Alan,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>You could try something like this </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>for(var i=0;
i<document.getElementsByTagName('IMG').length;i++){</FONT></DIV>
<DIV><FONT face=Arial size=2>
document.getElementsByTagName('IMG').oncontextmenu = function (){return
false}</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Laurent</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=alaneaston666@hotmail.com
href="mailto:alaneaston666@hotmail.com">Alan Easton</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu
href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, September 14, 2005 11:38
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Javascript] No right click
on images</DIV>
<DIV><BR></DIV>
<DIV>
<DIV class=RTE>
<P>Thanks Matt,</P>
<P>This does work, oncontextmenu="return false;"</P>
<P>however, the images involved are from a content management system, and the
client already has hundreds all over the site.</P>
<P>I was hoping there could be a universal function I could paste into the
HEAD of the page, and it would effect all images, instead of having to re-work
all the existing images.</P>
<P>I have been playing with this function, which works, but it has the alert
box popping up, and if I comment it out, the function does not work.</P>
<P>Any ideas........</P>
<P>//------------------code-----------------------</P>
<P><script type="text/javascript"></P>
<P>var clickmessage="Images Copyright NC3Rs 2005"</P>
<P>function disableclick(e) {<BR>if (document.all) {<BR>if
(event.button==2||event.button==3) {<BR>if
(event.srcElement.tagName=="IMG"){<BR>alert(clickmessage);<BR>return
false;<BR>}<BR>}<BR>}<BR>else if (document.layers) {<BR>if (e.which == 3)
{<BR>alert(clickmessage);<BR>return false;<BR>}<BR>}<BR>else if
(document.getElementById){<BR>if
(e.which==3&&e.target.tagName=="IMG"){<BR>alert(clickmessage);<BR>return
false;<BR>}<BR>}<BR>}</P>
<P>function
associateimages(){<BR>for(i=0;i<document.images.length;i++)<BR>document.images[i].onmousedown=disableclick;<BR>}</P>
<P>if (document.all)<BR>document.onmousedown=disableclick<BR>else if
(document.getElementById)<BR>document.onmouseup=disableclick<BR>else if
(document.layers)<BR>associateimages()</P>
<P><BR> </script></P>
<P>//-----------------code-----------------------<BR><BR>Again, all help
appreciated..........</P>
<P>Alan...</P></DIV>
<DIV></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><FONT
style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<HR color=#a0c6e5 SIZE=1>
<DIV></DIV>From: <I>Matt Barton
<javascript@mattbarton.org></I><BR>Reply-To: <I>"\[JavaScript
List\]" <javascript@LaTech.edu></I><BR>To: <I>"[JavaScript
List]" <javascript@LaTech.edu></I><BR>Subject: <I>Re:
[Javascript] No right click on images</I><BR>Date: <I>Wed, 14 Sep
2005 11:21:49 +0100</I><BR>>Hi Alan,<BR>><BR>>Pretend that at this
point I'm telling you all the things that loads <BR>>of other people are
likely to say about it being a bad idea, bad <BR>>practice, pointless if
the client doesn't have javascript enabled <BR>>etc, etc, and so on ad.
nauseum.<BR>><BR>>What you want is something like:<BR>><BR>>
<img oncontextmenu="return false;" src=
....<BR>><BR>> ... or ...<BR>><BR>> <img
oncontextmenu="returnValue = false;" src= ....<BR>><BR>>Try those, and
have an experiment, I'm sure it's something like
<BR>>that.<BR>><BR>>Matt<BR>><BR>>Alan Easton
wrote:<BR>>>Hello All,<BR>>> I realise this type of
function is quite pointless, but a client <BR>>>would like
it.<BR>>> I need to disable right click on images, but I DO
NOT want any <BR>>>alert box popping up, I merely do not want the
right click menu to <BR>>>appear.<BR>>> I also need
the right click to work on any other part of the <BR>>>screen, so they
can still right click and refresh, view source,
<BR>>>etc....<BR>>> Hope I have made myself clear,
let me know if you need anything <BR>>>else from
me.<BR>>> As usual, any help would be really
appreciated.<BR>>> Alan...<BR>>><BR>>>--<BR>>>This
email has been verified as Virus free<BR>>>Virus Protection and more
available at
http://www.plus.net<BR>>><BR>>><BR>>><BR>>>------------------------------------------------------------------------<BR>>><BR>>>_______________________________________________<BR>>>Javascript
mailing
list<BR>>>Javascript@LaTech.edu<BR>>>https://lists.LaTech.edu/mailman/listinfo/javascript<BR>>><BR>>>--<BR>>>This
email has been verified as Virus free<BR>>>Virus Protection and more
available at
http://www.plus.net<BR>>_______________________________________________<BR>>Javascript
mailing
list<BR>>Javascript@LaTech.edu<BR>>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></FONT></BLOCKQUOTE></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Javascript mailing
list<BR>Javascript@LaTech.edu<BR>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></BLOCKQUOTE></BODY></HTML>