Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7925691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:24:39+00:00 2026-06-03T18:24:39+00:00

I have used oncontextmenu to call a function on mouse right-click, it is working

  • 0

I have used oncontextmenu to call a function on mouse right-click, it is working fine on Firefox but causing problem on IE, context menu also appears along with the function.

I just need to call same function having some parameters on right and left click in pure JavaScript.

<html>
<script>
function mouseDown(e,param) {
  if (parseInt(navigator.appVersion)>3) {
    var clickType=1;
    if (navigator.appName=="Netscape") clickType=e.which;
    else clickType=event.button;
 
    if (clickType==1) {
      alert("left" +param);
    }

    if (clickType!=1) { 
      alert('right' + param);
    }
 }
 return true;
}

</script>
<body>
<a href="javascript:void(0)"
   onclick="mouseDown(event,'test1');"
   oncontextmenu="mouseDown(event,'test2');">mouse</a>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:24:44+00:00Added an answer on June 3, 2026 at 6:24 pm

    You need to return false; in the contextmenu event in order to prevent the default menu from showing up.

    Bear in mind that some browsers (Firefox in particular) defaults to not allowing JavaScript to block context menus, so you may encounter problems there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have used zend paginator in my app its working fine the way its
I have used split function to split the string in javascript. which is as,
I have used microsoft system.security.cryptography to make md5 in c# application but I need
I have used following code to add three variables but instead of adding these
I have used initialization lists a great deal in my C++ programs but wasn't
i have used filter to get the gradient and border-radius for round border but
I have used Broadcast receiver when it restarts it shows the launcher screen but
I have used escape function of java script to encode a java script string.
I need to open context menu by one click on view. I have already
Have used google maps dozens of times but cannot get around this one. Doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.