Right-click Context Menu That Can Pass Values When Right-clicking A Link??
Jul 23, 2005
Is it possible? Say We have a list of suppliers link like
A supplier
B supplier
when right click on a supplier, a context menu(that has
"details","view products", etc) appears and click on "view products
for this supplier" this click will redirect users to products page
showing all products from the supplier.
So href should look some like this
<a href="RightClicked(ཆ')">A supplier</a>
<script>
function RightClicked(supplierID)
{
// don't know I am making this up here
if (viewDetailsClicked)
ShowDetails(supplierID);
else if (viewProducts)
ShowProducts(supplierID)
etc
..
}
</script>
I recently started on a tree-folder display and used the Yahoo treeview control. Again it works very well and I am happy with the results. However, after seeing the treeview folder structure, my client asked if it would possible to add a right mouse click context menu to allow users to modify the folder tree -- add new folders, upload files, rename folders, delete folders, etc.
Updating the tree with the new elements is simple enough, but my attempts to implement the context menu have failed miserably. I have studied the Yahoo documentation and I can identify the name of nodes and the label of the element clicked on. But I can't figure out how to add the right-click code to the nodes the YUI Treeview generates.
I have successfully used various right-click Javascript scripts in the past -- but in those cases I was adding the function to an actual HTML element. The YUI elements are generated by the script, and I am at a loss as how to add the code to the generated node elements.
The application is part of a corporate intranet, and will only be used with Internet Explorer 6.0+ on Windows. The new context menu would completely replace the standard Windows context menu.
I am tempted to hack the YUI Treeview script to see if I can add a right click function similar to the Expand, Collapse and Clicked node functions, but I suspect that there is probably a simpler and easier way to do it.
I am using a script so that a url selected from a dropdown is given control using the window.location method. This depends on the onsbumit definition attached to the action statement. All that works well. However, I have other checkboxes etc. on the form, and their values are no longer submitted when I used this onsubmit function. Is there a way I can get them to work... Here is the script and the form:
I'm trying to figure out how to tackle this problem: I have an XML table with a cool grid in which users can select a table row. When they right-click on a cell, they get a modal dialog window with a selection menu. What I want this thing to do is display the different values in the row, so that users can make a selection: eventually I want it to be a filter option > in the selection menu, users can select the value on which they want the whole table to be filtered. However, I'm seriously lacking js-skills so I don't know how I should pass the values from the table row to the selection menu. Code:
I have one page which is the server processing where the link is and the other page which shows the user page.On clicking on the link I manage to make a panel (slide toggle kind) be displayed alright. But I still need that on clicking on that link a value is passed. I think I have to write a couple of lines more in the Ajax snippet but dont know how exactly. I have seen a similar question but havent been able to translate it to my specific case.[code]Well, somewhere in the middle or maybe in another Ajax snippet I should put that $get and this should be returned so that a SQL query can take that value and work with it.
I know how to disable the context menu (the right hand mouse button) and how to replace it by my own menu. I also know that not everybody likes this - so let's not discuss about that here.
What I can't figure out and what I would like to know, is: 1) How to ADD elements to it, i.e. keep the original contents and add something to it; 2) How to RESTORE it to its original contents.
Does anyone know the code for a simple working example of these things?
I am creating html pages with forms where I use Dynarch menu script in a context menu mode. Their script needs to be initialized like this: <body onload="DynarchMenu.setup('menu', { context: true });">
This is in the beginning of the html page. But, in my webpages I have only few pages where I actually use this kind of menu. Since I use smarty template engine, I have single html-header file for all pages - it includes the same <html><head><bodyetc. for each page. So I tried to initialize this dynarch script only within the page that actually uses this menu. I do it like this:
<form>[...]</form> <ul id="menu"> [context menu elements definition here] </ul>
This thing works OK in Firefox, however when I load such page in IE6 it aborts the operation without even showing the page, and the popup message says:
"Internet Explorer cannot open the Internet site http://example.com. Operation aborted."
Does anyone know a way how to initialize the DynarchMenu.setup not from the <bodyelement but from anywhere else in the html page?
I have a problem with YUI context menu. I want the menu to show different links (with product_id) in every row. I have been struggling with this for days no without result.My code is as follow:
As you can see table row takes menu items according to id (type1, type2 etc).But as my table is created from mysql database dynamically, it does'n work that way.
I am displaying my own context menu in response to a right-click on control (textbox) in my ASP.NET application. In IE, I can suppress the display of the browser's own context menu by simply returning false from the javascript that displays my context menu.How can I suppress the browser context menus from Chrome or Firefox?
Assuming I have an image in my page I would like to invoke the 'save as' context menu for that image when the user left-clicks the image I will have a link embedding the image. Clicking the link should invoke the menu and allow the user to save the image
Assuming I have 2 images. Image A and image B. Image B is a small thumbnail version of image A Image B is displayed on the screen When the user left-clicks it, the 'save as' context menu should open (see previous question) and will allow the user to save image A (this is right, the original image and not the thumbnail being display) Is this possible?
I have a TEXTAREA element. A user right clicks within in to get the context menu and they select "paste". I want my javascript code to know that they selected "paste". I know you can capture the mouse click, but can we capture exactly what event that attempted?
I am doing an internship at a company and am working on an existing site. The Company wants the expanding menu to stay expanded when you click a link to go to another page while navigating. I am very new to Javascript, CSS, and html and could really use some insight or code example.
// JavaScript Document /* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com
code to disable right click menu when we right click on "a" tag. But it doesn't work on elements created on the fly. Do you guys know how to tackle this?
I try to use the Plugin in SP. The problem is, that the offset is calculated wrong when using it in a Webpart. So the contextmenu is always displayed a litlle bit more to the right and a litle bit more to the bottom of the page. Playing with the left and top values using firebug i have figured out, that the top left corner is inside the webpart right underneath the title of the webpart.
Is there a way to manipulate the plugin so the position of the menu is corrected?
Using onclick=window.open function in js to open a pdf file link in a new popup window. Works fine to display the file onscreen, but not if the user wants to save the file client-side to their computer. The right-hand-button context menu for the mouse will allow the user to download, but the file saved will be a html dump file for the webpage and the name of the file will be that for the webpage. Of course I can use the easy <a href> method for download links and the mouse context menu options will be as expected, but I can only use target="-blank" or target="_self". I need a popup window to open.
Could use : oncontextmenu="alert('Left click the link to open, and then SAVE from with the pdf viewer') to advise users how to save the file, and could use: "javascript: void(0)" To eliminate most mouse context menu options, so the user won't bother try. So how can I get a link to a file which can be viewed in a popup window and downloaded using mouse right-hand context menu?
I have a situation where a context menu is being added to the DOM dynamically when a user right clicks on a control on the page. The div that gets added does not have an id set but the div does have a unique class. WhatI need to do is intercept the addition of the div and add a hover affect to some child nodes. Specifically any children that are <a> nodes. So far this is whatI have for adding the hover affect, but i'm not sure where it needs to go or howI link it to the event raised whan a new element is added to the dom.
provide me with code to make a collapsible menu? What I'm looking for is a vertical menu, that will open up the sub-categories upon a mouseover. Clicking on the menu item will bring them to the specific page. Oh, and this might not matter, but I'd prefer if I was able to style the menu to fit with my site theme.
I would like to set the link's "visited" pseudo-class with javascript without clicking on the link. My goal is to update the link's color (previously set in the CSS file) to be "visited" without actually clicking on the link and then clicking "back" in the browser.
Does anyone know how? Here are the following things I've already tried to no avail:
var obj = document.getElementById("idOfMyLink");
//obj.visited=true; // NO //obj.style.visited=true; // NO //obj.click(); // NO, performs a click and takes me away from current page
/* // Setting the src of an iframe on the same page, trying to "stuff" this URL into browser's "History"
var theFrame = document.getElementById("myiframe"); theFrame.src = obj.href;
// NO. The iframe does go to correct URL, but the link's color doesn't update.*/Any ideas?
I want to have a javascript popup box so that when a hyperlink is clicked, a user is asked if they are sure they want to click this link, if they select ok then the page loads, if they click canel then nothing happens, However when a user clicks cancel the link still loads, can anyone see where I am going wrong?
I have a couple of links which when clicking on them start a video. In another div with id="info" I want to give more information about the video which is playing. When you click on a new link and the video starts the information should update. The information wich is in a list item is hidden with display: none before you click on the link. My problem is that the information of the previous video is not disappearing when I start a new one. I don't know what to write to make the information of the previous video disappear.
I tried empty() and remove() but then the div id="info" shows nothing. #info { width: 195px; height: 338px; border: 2px black solid; } .hide {display: none;} <script> $(document).ready(function(){ $('#text1').click(function () { $('#mona').show(300); }); .....
I got a paragraph, and i want the letter of A will change to N and the letter of P will change to A when i click the link of the "click me to change the letter".
I have a pages with list of sites and when I click on links to other domains, the other domains will see the referer where I clicked from. How can I avoid the referer when clickin on links on my page? (I don't want to click new IE browser and paste the url).