Having RTFMed and searched, I am still not sure that it is possible. It seems it should be, but what I tried doesn't work (probably due to the fact that I am new to Javascript).

I am formatting training lab books using XHTML with XML custom tags. I want to give students a reminder that copying and pasting commands is not conducive to learning, so I want to disable right mouse click, but only when they try to copy a command contained in a specific tag. Here is the script I am trying:

HTML Code:
//<![CDATA[
document.createElement ("pnum")
pnum.onmousedown=disableclick;
status="Copying and pasting commands is detrimental to learning";
function disableclick(e)
{
  if(event.button==2)
   {
     alert(status);
     return false;    
   }
}
//]]>
It works perfect without the first line and with "document.onmousedown" in the second, but that affects entire document. Is onmousedown only possible within document and window, or am I missing something obvious?