Right Button Engages Menu

[Total: 0    Average: 0/5]

This is a neat little menu that pops up when the right button is clicked.

Head Code:

<SCRIPT>
<!--
function BrowserCheck() {
 var b = navigator.appName
 if (b=="Netscape") this.b = "ns"
 else if (b=="Microsoft Internet Explorer") this.b = "ie"
 else this.b = b
 this.version = navigator.appVersion
 this.v = parseInt(this.version)
this.ns = (this.b=="ns" && this.v>=4)
this.ns4 = (this.b=="ns" && this.v==4)
 this.ns5 = (this.b=="ns" && this.v==5)
 this.ie = (this.b=="ie" && this.v>=4)
 this.ie4 = (this.version.indexOf('MSIE 4')>0)
this.ie5 = (this.version.indexOf('MSIE 5')>0)
 this.min = (this.ns||this.ie)
}
is = new BrowserCheck()
document.onmousedown = mouseDown
if (is.ns) document.captureEvents(Event.MOUSEDOWN)
function mouseDown(e) {
 if ((is.ns && e.which == 1) || (is.ie && event.button == 1)) {
 }
  else {
 if (is.ns) setTimeout('alert("Netscape ")',50)
  }
   }
//-->
</SCRIPT>

<SCRIPT language=JavaScript>
<!--
function stopError() {
return true;
}
window.onerror = stopError;
// -->
</SCRIPT>


<SCRIPT language=JavaScript>
<!--
function openLoader( windowURL, windowName, windowFeatures ) {
return window.open( windowURL, windowName, windowFeatures ) ;
} 
// -->
</SCRIPT>

<STYLE>#menu {
	BACKGROUND-COLOR: #000000; BORDER-BOTTOM: #ffffff 2px solid; BORDER-LEFT: #ffffff 2px solid; BORDER-RIGHT: #ffffff 2px solid; BORDER-TOP: #ffffff 2px solid; CURSOR: default; FONT-FAMILY: arial; FONT-SIZE: 8pt; LINE-HEIGHT: 20px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 140px
}
.menuitems {
	PADDING-LEFT: 15px; PADDING-RIGHT: 15px; TEXT-ALIGN: right
}
</STYLE>

<SCRIPT language=JavaScript1.1>
<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
//  End -->
</SCRIPT>

<SCRIPT language=JavaScript1.2>
function showmenuie5(){
menu.style.left=document.body.scrollLeft+event.clientX
menu.style.top=document.body.scrollTop+event.clientY
menu.style.visibility="visible"
return false
}
function hidemenuie5(){
menu.style.visibility="hidden"
}
function highlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor="#FD8449"
event.srcElement.style.color="white"
if (display_url==1)
window.status=event.srcElement.url
}
}
function lowlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor=""
event.srcElement.style.color="#FFFF00"
window.status=''
}
}
function jumptoie5(){
if (event.srcElement.className=="menuitems")
window.location=event.srcElement.url
}
</SCRIPT>

Body Code:

<FONT color=#ffff00 face=Arial size=2><B>
<DIV id=menu onclick=jumptoie5() onmouseout=lowlightie5() onmouseover=highlightie5()>
<DIV class=menuitems target="self" url="http://www.js-examples.com/">Home Page</DIV>
<DIV class=menuitems target="self" url="http://www.js-examples.com/consult/">Consulting</DIV>
<DIV class=menuitems target="self" url="http://www.js-examples.com/example/">JavaScript Search</DIV></div>
</div>
<SCRIPT language=JavaScript1.2>
document.oncontextmenu=showmenuie5
if (document.all&&window.print)
document.body.onclick=hidemenuie5
</SCRIPT>
IE only.<BR>
<font color=black>Type right button</font>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *