Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
|
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2007, 12:26 AM
Authorized User
 
Join Date: Sep 2007
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Right click to Open a menu

Hi,

I have a list (<li>) and need to display a menu when user [u]right </u>clicks on an item. is there any javascript function to do that?

<li onclick ="funct()"> item </li>

Thanks,
 
Old October 12th, 2007, 06:28 AM
Registered User
 
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes we can,

  I hope below example helps you.Instead of onclick you have to use oncontextmenu.

  // e is the event which gecko engines required where el is the <li> tag
  function showMenu(e,el) {
     with(el) {
       position='absolute';
       style.cssText="font:...."; // your css for menu appearance.
       left= (window.event) ? event.clientX : e.clientX;
       top= (window.event) ? event.clientY : e.clientY;
       display = "block";
    }
     return false;// suspend the browser specific right click menu.
  }

 Just try this ..

Keep Smiling that doesn't cost you much...

Hari Kishore.
 
Old November 5th, 2007, 02:25 AM
Authorized User
 
Join Date: Sep 2007
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a million!:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Before Right Click showpopup menu davespearce Excel VBA 0 December 11th, 2007 08:03 PM
right click on a menu item chuckcottle C++ Programming 3 May 14th, 2007 10:34 AM
Generate a menu when right click a cell Andraw Classic ASP Basics 4 March 24th, 2005 05:37 PM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 03:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.