SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jan 2001
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know where i can find the no right click script that when someone's right clicks on the mouse they get no popup menu? I couldn't find it on any free Java script sites all they have is the old one and I can't remember the site I seen it on

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright,

    I took a script from The JavaScript Source (http://javascript.internet.com/page-details/no-right-click.html) and modified it. It's really simple: I just removed a line of code.

    I havn't tested it, but it should work. I'm not sure if Im even allowed to modify the code as such, but I think it'll be fine, as long as the copyright notices and such are there.

    Code:
    <SCRIPT LANGUAGE="JavaScript1.1">
    <!-- Original:  Martin Webb (martin@irt.org) -->
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    function right(e) {
    if (navigator.appName == 'Netscape' && 
    (e.which == 3 || e.which == 2))
    return false;
    else if (navigator.appName == 'Microsoft Internet Explorer' && 
    (event.button == 2 || event.button == 3)) {
    return false;
    }
    return true;
    }
    
    document.onmousedown=right;
    document.onmouseup=right;
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    if (document.layers) window.captureEvents(Event.MOUSEUP);
    window.onmousedown=right;
    window.onmouseup=right;
    //  End -->
    </script>
    Hope that helps.

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dang! Doesn't work. I tried changings 3 or 4 things around, but to no avail. Simply removing the alert() command didn't work, which kind of has me baffled. I figured the "return false;" would still do it, but apparently not.

    Maybe I should try to stick some other command in there? I dunno - if I get something to work I'll let you know.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •