Forum Moderators: open
I found that the little unobtrusive copyright notice I put up for right hand click, on the pages with original photographs, only works in IE. In Netscape it's as if I never had the code on the page.
Is there a workaround to make a javascript pop up, pop up on Newscape Navigator, too?
If it'll help, I'm using in the head:
<STYLE>
#contextMenu {
position: absolute;
visibility: hidden;
width: 120px;
background-color: #9966ff;
layer-background-color: lightgrey;
border: 2px outset white;
}
.A:Menu {
color: black;
text-decoration: none;
cursor: default;
width: 100%
}
.A:MenuOn {
color: white;
text-decoration: none;
background-color: darkblue;
cursor: default;
width: 100%
}
</STYLE>
<SCRIPT>
var menu;
function showMenu (evt) {
if (document.all) {
document.all.contextMenu.style.pixelLeft = event.clientX;
document.all.contextMenu.style.pixelTop = event.clientY;
document.all.contextMenu.style.visibility = 'visible';
return false;
}
else if (document.layers) {
if (evt.which == 3) {
document.contextMenu.left = evt.x;
document.contextMenu.top = evt.y;
document.contextMenu.onmouseout =
function (evt) { this.visibility = 'hide'; };
document.contextMenu.visibility = 'show';
return false;
}
}
return true;
}
if (document.all)
document.oncontextmenu =showMenu;
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = showMenu;
}
</SCRIPT>
and i'm using in the top of the body:
<DIV ID="contextMenu"
ONMOUSEOUT="menu = this; this.tid = setTimeout
('menu.style.visibility = \'hidden\'', 20);"
ONMOUSEOVER="clearTimeout(this.tid);"
>
If interested in purchasing this copyrighted print<A HREF="contact.html";
CLASS="menu"
ONMOUSEOVER="this.className = 'menuOn'"
ONMOUSEOUT="this.className = 'menu';" >
please reach the artist</a> for sizing and price.
<BR>
<A HREF="http://<snip>.net"; CLASS="menu"
ONMOUSEOVER="this.className = 'menuOn'"
ONMOUSEOUT="this.className = 'menu';"
></A>
</DIV>
thanks for reading -- judithem
[edited by: BlobFisk at 3:43 pm (utc) on May 27, 2004]
[edit reason] The posting of URLs is against TOS here (even in code). [/edit]
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers¦¦document.getElementById&&!document.all){
if (e.which==2¦¦e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
______________________________________________________
Hope this script works out for you!
Please tell me, as I'm not fluent in Java:
Is that code meant for the header of the html file?
Only? Does it go in the body? The one I showed had a piece in each place.
A week ago in the header I had on an alarm notice of sorts under the right click, but all in all it felt way too rough for the viewer. I removed it in lieu of this one which is gentle and now I realize it isn't cross browser at all. So.
I would like to gently remind my visitors that right clicking might bring them in contact with the photographer who made the copyrighted photo they are looking at, thus dissuading them from thoughtlessly downloading the material.
What I liked about the code I presented here that unfortunately only works in IE, is that I can design my little box's style. I'd like that flexibility so I can personalize the page.
Can the script so thoughtfully provided in message two, be personalized?
Is there some other one that can?
My sincere thanks,
JudithEm
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers¦¦document.getElementById&&!document.all){
if (e.which==2¦¦e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
______________________________________________________
Best of luck with your site :)
[I haven't had a mac in ten years. I grew up on macs. I'm simply trying to please a client. We may end up getting a digimark watermark.]
Thanks for pasting the code, I'll check it out.
Can it be modified stylewise?
I'd prefer the flexibility of a cross-browser right click code with which I can determine the text style and colors too. Is that possible?