Results 1 to 7 of 7

Thread: Disable right click popup //resolved//

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Disable right click popup //resolved//

    To understand my question, head over to http://mendhak.worldjunkie.com/

    It works if you're using IE.
    Now, if you left click anywhere on the page, it goes over to phpinfo.html
    If you right click anywhere on the page, however, the right click menu pops up, and then heads over to phpinfo.html

    How can I get rid of this right click's menu?


    Also, the javascript I'm using is this:

    Code:
    <script language="JavaScript">
    function click(e) {
    if(event.button==2){
    
    
    document.location.href='phpinfo.html';
    return true;
    }
    else
    {
    document.location.href='phpinfo.html';
    }
    }
    
    document.onmousedown=click;
    
    </script>
    Anyone good with stuff for Netscape and the other non-IE browsers? How would I write the same script for those browsers?

    Thanks.
    Last edited by mendhak; Jan 31st, 2003 at 12:14 PM.

  2. #2
    Lively Member
    Join Date
    Dec 2002
    Location
    southwest pennsylvania
    Posts
    65
    i think the onContextMenu event handles that menu thingy
    if you choose not to decide you still have made a choice!

    RUSH rocks!

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Thumbs up

    Originally posted by joeframbach
    i think the onContextMenu event handles that menu thingy
    Great, thanks. I just had to put

    Code:
    <BODY onContextMenu = "return false;">
    and the code worked fine.

  4. #4

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I am now using this code:

    Code:
    <script language="JavaScript">
    
    
    function redir(){
    document.location.href='phpinfo.html';
    }
    
    document.onmousedown=redir;
    </script>
    Since onContextMenu has been eliminated. But now when I go to http://mendhak.worldjunkie.com/ I get "Syntax error on line 22" (It works fine on my machine).

    Line 22 would be <body ... onContextMenu = "return: false;"

    What have I done wrong?

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    And the right click context menu is showing up again.

  6. #6
    Lively Member
    Join Date
    Dec 2002
    Location
    southwest pennsylvania
    Posts
    65
    get rid of the : after return
    if you choose not to decide you still have made a choice!

    RUSH rocks!

  7. #7

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    :embarassed:

    Must be all that CSS...

Posting Permissions

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



Click Here to Expand Forum to Full Width