window| Menu | The page wants to make a menu similar to Windows in the Web form, but the post asks nobody back, fumbling for a day later, finally found a similar approach in MSDN, as follows:
(The following code posts to Notepad to run the view directly)
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<html xmlns:mshelp=http://msdn.microsoft.com/mshelp>
<HEAD>
<title>oncontextmenu Event sample</title>
<meta http-equiv= "Content-type" content= "text/html"; Charset=iso-8859-1 ">
<meta name= "AUTHOR" content= "InetSDK" >
<meta name= "MS. LOCALE "content=" en-US ">
<meta name= "ROBOTS" content= "Noindex" >
<!--Set the background style of the menu-->
<STYLE>
. menuItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
Background-color:menu;color:black}
. highlightitem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
Background-color:highlight;color:white}
. Clickablespan {padding:4;width:500;background-color:blue;color:white;border:5px Gray solid}
</STYLE>
<SCRIPT>
//<!--
//pop-up menu:
function DisplayMenu () {
whichdiv=event.srcelement;
menu1.style.leftpos+=10;
Menu1.style.posleft=event.clientx;
Menu1.style.postop=event.clienty;
menu1.style.display= "";
menu1.setcapture ();
}
//Highlight mouse move is the background of the menu
function Switchmenu () {
el=event.srcelement;
if (el.classname== "MenuItem") {
el.classname= "Highlightitem";
} else if (el.classname== "Highlightitem") {
el.classname= "MenuItem";
}
}
Click the menu item to trigger the corresponding event
function Clickmenu () {
menu1.releasecapture ();
menu1.style.display= "None"; Click to hide Menu
el=event.srcelement;
if (el.id== "mnured") {
whichdiv.style.backgroundcolor= "Red";
} else if (el.id== "Mnugreen") {
whichdiv.style.backgroundcolor= "Green"; When Green is selected, the background changes to
} else if (el.id== "Mnublue") {
whichdiv.style.backgroundcolor= "Blue"; The background changes to blue when Blue is selected
} else if (el.id== "Mnuyellow") {
whichdiv.style.backgroundcolor= "Yellow"; When you select yellow, the background turns yellow
}
}
//-->
</SCRIPT>
<!--sample_style_start-->
<link rel= "stylesheet" href= "/workshop/basicsdkie4.css" type= "Text/css" >
<!--sample_style_end-->
<link rel= "stylesheet" type= "Text/css" href= "ms-help://hx/hxruntime/hxlink.css" ><style TYPE= "Text/css" >
pre.clscode {font-size:110%;}
pre.clssyntax {font-size:100%;}
TD Div.clsbeta {display:none;}
Mshelp\:link {
color: #0000ff;
Text-decoration:underline;
Cursor:hand;
Hovercolor: #3366ff;
filterstring:;}
</STYLE>
</HEAD>
<!--toolbar_start-->
<!--toolbar_exempt-->
<!--toolbar_end-->
<body topmargin=0 leftmargin=0 bgproperties= "FIXED" bgcolor= "#FFFFFF"
link= "#000000" vlink= "#808080" alink= "#000000" >
<blockquote class= "Body" >
<!--contents_start-->
<h1>oncontextmenu Event sample</h1>
<p>this sample shows the <B>oncontextmenu</B> event handler, available in Microsoft®internet Explorer 5 and later, to display both standard and custom context menus and prevent the context menus from displaying. Experiment with each of the "following boxes to" can apply different methods either to display or to inhibit con Text menus. Each box provides instructions for your to follow.
</P>
<span class= "Clickablespan" >
1. The default context menu always displays when you are right-click in this box.
<b><br>code: </b>
//no code Necessary
</SPAN><br><br>
<span class= "Clickablespan" oncontextmenu= "return Event.ctrlkey" >
2. The default context menu, displays only if you are right-click in this box while holding down the Ctrl key. This is useful the for developing and debugging purposes.
<b><br>code: </b>
oncontextmenu= "Return Event.ctrlkey"
</SPAN><br><br>
<span class= "Clickablespan" oncontextmenu= "re