<!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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>You could try something like this </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>for(var i=0; 
i&lt;document.getElementsByTagName('IMG').length;i++){</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
document.getElementsByTagName('IMG').oncontextmenu = function (){return 
false}</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&lt;script type="text/javascript"&gt;</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&amp;&amp;e.target.tagName=="IMG"){<BR>alert(clickmessage);<BR>return 
  false;<BR>}<BR>}<BR>}</P>
  <P>function 
  associateimages(){<BR>for(i=0;i&lt;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>&nbsp;&lt;/script&gt;</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:&nbsp;&nbsp;<I>Matt Barton 
    &lt;javascript@mattbarton.org&gt;</I><BR>Reply-To:&nbsp;&nbsp;<I>"\[JavaScript 
    List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To:&nbsp;&nbsp;<I>"[JavaScript 
    List]" &lt;javascript@LaTech.edu&gt;</I><BR>Subject:&nbsp;&nbsp;<I>Re: 
    [Javascript] No right click on images</I><BR>Date:&nbsp;&nbsp;<I>Wed, 14 Sep 
    2005 11:21:49 +0100</I><BR>&gt;Hi Alan,<BR>&gt;<BR>&gt;Pretend that at this 
    point I'm telling you all the things that loads <BR>&gt;of other people are 
    likely to say about it being a bad idea, bad <BR>&gt;practice, pointless if 
    the client doesn't have javascript enabled <BR>&gt;etc, etc, and so on ad. 
    nauseum.<BR>&gt;<BR>&gt;What you want is something like:<BR>&gt;<BR>&gt; 
    &lt;img oncontextmenu="return false;" src= 
    ....<BR>&gt;<BR>&gt;&nbsp;&nbsp;... or ...<BR>&gt;<BR>&gt; &lt;img 
    oncontextmenu="returnValue = false;" src= ....<BR>&gt;<BR>&gt;Try those, and 
    have an experiment, I'm sure it's something like 
    <BR>&gt;that.<BR>&gt;<BR>&gt;Matt<BR>&gt;<BR>&gt;Alan Easton 
    wrote:<BR>&gt;&gt;Hello All,<BR>&gt;&gt;&nbsp;&nbsp;I realise this type of 
    function is quite pointless, but a client <BR>&gt;&gt;would like 
    it.<BR>&gt;&gt;&nbsp;&nbsp;I need to disable right click on images, but I DO 
    NOT want any <BR>&gt;&gt;alert box popping up, I merely do not want the 
    right click menu to <BR>&gt;&gt;appear.<BR>&gt;&gt;&nbsp;&nbsp;I also need 
    the right click to work on any other part of the <BR>&gt;&gt;screen, so they 
    can still right click and refresh, view source, 
    <BR>&gt;&gt;etc....<BR>&gt;&gt;&nbsp;&nbsp;Hope I have made myself clear, 
    let me know if you need anything <BR>&gt;&gt;else from 
    me.<BR>&gt;&gt;&nbsp;&nbsp;As usual, any help would be really 
    appreciated.<BR>&gt;&gt;&nbsp;&nbsp;Alan...<BR>&gt;&gt;<BR>&gt;&gt;--<BR>&gt;&gt;This 
    email has been verified as Virus free<BR>&gt;&gt;Virus Protection and more 
    available at 
    http://www.plus.net<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;------------------------------------------------------------------------<BR>&gt;&gt;<BR>&gt;&gt;_______________________________________________<BR>&gt;&gt;Javascript 
    mailing 
    list<BR>&gt;&gt;Javascript@LaTech.edu<BR>&gt;&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>&gt;&gt;<BR>&gt;&gt;--<BR>&gt;&gt;This 
    email has been verified as Virus free<BR>&gt;&gt;Virus Protection and more 
    available at 
    http://www.plus.net<BR>&gt;_______________________________________________<BR>&gt;Javascript 
    mailing 
    list<BR>&gt;Javascript@LaTech.edu<BR>&gt;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>