View Full Version : Right Click......
clairemoore
11-17-2005, 11:33 AM
Hi all
I need some code ........Please........
I have some code that produces a right click menu, however what i really need is some code so that when the user right clicks on a link a menu appears, is this possible and if so how would i do this????
Thanks to everyone in advance......
:thumbsup:
ecnarongi
11-17-2005, 05:11 PM
example (http://www.dynamicdrive.com/dynamicindex1/anylinkvertical.htm)
Change the onmouseover event to onclick or keydown. If this is not what you are looking for, give more detail.
felgall
11-17-2005, 07:55 PM
Not all browsers allow you to manipulate ther content of that menu. For cross browser compatibility you need to provide an alternative.
clairemoore
11-18-2005, 11:11 AM
:confused: Heres my code How would I manipulate this so the right click menu only appered when you right click on the menu NOT the whole page
<html>
<HEAD>
<title>right click menu</title>
<style>
<!--
.skin0 {
position:absolute;
text-align:left;
width:200px;
border:2px solid black;
background-color:menu;
font-family:Verdana;
line-height:20px;
cursor:default;
visibility:hidden;
}
.skin1 {
cursor:default;
font:menutext;
position:absolute;
text-align:left;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
width:120px;
background-color:menu;
border:1 solid buttonface;
visibility:hidden;
border:2 outset buttonhighlight;
}
.menuitems {
padding-left:15px;
padding-right:10px;
}
-->
</style>
<SCRIPT LANGUAGE="JavaScript1.2">
var menuskin = "skin1"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
function showmenuie5() {
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
else
ie5menu.style.top = document.body.scrollTop + event.clientY;
ie5menu.style.visibility = "visible";
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "highlight";
event.srcElement.style.color = "white";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "";
event.srcElement.style.color = "black";
window.status = "";
}
}
function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
}
}
</script>
</head>
<body>
<div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5();">
<div class="menuitems" url="http://busnet.it">Pippo</div>
<div class="menuitems" url="http://busnet.it">Pluto</div>
<div class="menuitems" url="http://busnet.it">Ciao</div>
</div>
<script language="JavaScript1.2">
if (document.all && window.print) {
ie5menu.className = menuskin;
document.oncontextmenu=showmenuie5
document.body.onclick = hidemenuie5;
}
</script>
<table width="70%" border="2">
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.