<html><div style='background-color:'><P>Thanks for the help Troy, and Laurent, you have both basically helped me get it sorted.</P>
<P>I realise you cannot prevent your images being taken, all developers know it, but it is basically a bit of "piece and mind" for the client. They feel something like this enough of a deterent to the normal web user.</P>
<P>But thanks for all your help guys, much appreciated as usual.</P>
<P>Cheers,</P>
<P>Alan...<BR><BR></P>
<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>
From: <I>"Troy III Ajnej" &lt;trojani2000@hotmail.com&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To: <I>javascript@LaTech.edu</I><BR>Subject: <I>Re: [Javascript] No right click on images</I><BR>Date: <I>Thu, 15 Sep 2005 06:32:26 +0200</I><BR><BR>
<DIV>
<P>Is it possible that you are calling a function inside the function without ()?</P>
<P>See the content of the function and determine what function was displayed and add () to it's name where called.</P>
<P>But in any case, this script will not&nbsp;disable it,&nbsp;the contextmenu will fire anyway if you remove the alertBox.</P>
<P>Practically, I must say that it is impossible to prevent the user from copying the image once displayed in the browser, for you can find it in the browsercache, but one can make it more dificult for starters.</P>
<P>On&nbsp;IE there is a point where you can handle the contextmenu fairly. It can disable the context menu as a generated event with its own name of event, 'oncotextmenu' and will not disrrupt other generic events, without having to use the alert box for handling event before bubling to other awaiting handlers. So there is no way of doing it without contextmenu caller. I don't know if oncontextmenu exists in many other browsers but without a call from it you can't escape from using alerts to emulate it.</P>
<P>In IE you can do it in this simple manner</P>
<P>function nocontext(){ if (event.srcElement.src){return false}}</P>
<P>document.oncontextmenu=nocontext</P>
<P>No images on the page will display the context menu,&nbsp;allowing all other elements&nbsp;to preserve this ability, because during 'if' condition, only the img elements will not return 'undefined' or empty string.</P>
<P>The same situation with the F1 button, you can't disable it with keypress etc, the only way is to&nbsp;call from 'onhelp' event&nbsp;so you can&nbsp;return false</P>
<P>The 'oncontextmenu' event is suported at least by two widely used and most important browsers,&nbsp;ie 5 and&nbsp;nn 6,&nbsp;possibly supported by&nbsp;some other Safari and Firefox versions. </P>
<P>for other than IE browsers use 'target' instead of 'srcElement' or try this:</P>
<P>function nocontext(e){&nbsp;var sourcEl; </P>
<P>&nbsp;&nbsp; if (!e) var e=window.event; </P>
<P>&nbsp;&nbsp;&nbsp; if (e.target){sourcEl=e.target.src;} </P>
<P>&nbsp;&nbsp;&nbsp; else if(e.srcElement){sourcEl=e.srcElement.src;} </P>
<P>&nbsp;&nbsp;&nbsp; if (sourcEl){ //if true -it is image! than<BR>return false}<BR>}</P>
<P>NOTE: this function is not tested&nbsp;in other&nbsp;than ie...</P>
<P class=MsoBodyText style="MARGIN: 0pt"><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<HR color=#a0c6e5 SIZE=1>

<P></P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px">
<P>From: <I>"Alan Easton" &lt;alaneaston666@hotmail.com&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To: <I>javascript@LaTech.edu</I><BR>Subject: <I>Re: [Javascript] No right click on images</I><BR>Date: <I>Wed, 14 Sep 2005 13:59:42 +0100</I><BR><BR></P>
<DIV>
<P>Hi Troy,</P>
<P>I tried that, but it just renders the function useless. Stange. I thought that maybe it was using the alert box as a replacement for the right click menu that appears there...</P>
<P>Any thoughts.....<BR><BR></P>
<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>
From: <I>"Troy III Ajnej" &lt;trojani2000@hotmail.com&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To: <I>javascript@LaTech.edu</I><BR>Subject: <I>Re: [Javascript] No right click on images</I><BR>Date: <I>Wed, 14 Sep 2005 13:03:36 +0200</I><BR><BR>
<DIV>
<P>I see that you allready have some kind of script that will do...</P>
<P>Why don't you simply delete the alert's from the script?<BR>From this part of the script I don't see that alert has any further dependencies delete the var clickmessage also, you don't need it either.<BR></P>
<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>
From: <I>"Alan Easton" &lt;alaneaston666@hotmail.com&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To: <I>javascript@LaTech.edu</I><BR>Subject: <I>Re: [Javascript] No right click on images</I><BR>Date: <I>Wed, 14 Sep 2005 11:38:43 +0100</I><BR><BR>
<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><BR>
<P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;Javascript@LaTech.edu<BR>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<P></FONT></P></BLOCKQUOTE></DIV><BR clear=all>
<HR>
Express yourself instantly with MSN Messenger! <A href="http://g.msn.com/8HMAEN/2734??PS=47575">MSN Messenger</A> Download today it's FREE! <BR>
<P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;Javascript@LaTech.edu<BR>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<P></FONT></P></BLOCKQUOTE></DIV><BR>
<P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;Javascript@LaTech.edu<BR>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<P></FONT></P></BLOCKQUOTE></DIV><BR clear=all>
<HR>
<A href="http://g.msn.com/8HMAENUS/2755??PS=47575">Get the NEW version of MSN Messenger with Video Conversation - it's FREE!</A> <BR>
<P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;Javascript@LaTech.edu<BR>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<P></FONT></P></BLOCKQUOTE></div></html>