View Single Post
  #1 (permalink)  
Old April 6th, 2006, 10:16 AM
crmpicco crmpicco is offline
Friend of Wrox
Points: 6,811, Level: 35
Points: 6,811, Level: 35 Points: 6,811, Level: 35 Points: 6,811, Level: 35
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,518
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default disable right-click on FF and OP

Code:
// Prevent page from being right-clicked at any point
// for images, view source etc....
if (window.Event)
{
    document.captureEvents(Event.MOUSEUP);
}

function nocontextmenu() 
{
    event.cancelBubble = true, event.returnValue = false;
    return false;
} 

function norightclick(e) 
{
    if (window.Event) 
    {
        if (e.which == 2 || e.which == 3) 
        {
            return false;
        }
        else if (event.button == 2 || event.button == 3) 
        {
            event.cancelBubble = true, event.returnValue = false;
            return false;
        }
    }
}

if (document.layers)
{
    document.captureEvents(Event.MOUSEDOWN);
}

document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;
This code works on IE6 (and 7), but does anyone have a version that will work on FF/OP?

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote