|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP脚本是采用明文(plaintext)方式来编写的。window|菜单|页面想在WebForm中做出与windows中类似的菜单,但是发帖问人又没人回,本人探索忧郁了一天以后,终究在MSDN中找到了类似的办法,详细以下:
(上面的代码帖到记事天性间接运转检察)
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN">
<HTMLxmlns:MSHelp=http://msdn.microsoft.com/msHelp>
<HEAD>
<TITLE>oncontextmenuEventSample</TITLE>
<METAHTTP-EQUIV="Content-Type"CONTENT="text/html;CHARSET=iso-8859-1">
<METANAME="AUTHOR"CONTENT="InetSDK">
<METANAME="MS.LOCALE"CONTENT="EN-US">
<METANAME="ROBOTS"CONTENT="noindex">
<!--设置菜单的背景款式-->
<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:5pxgraysolid}
</STYLE>
<SCRIPT>
//<!--
//弹出菜单:
functiondisplayMenu(){
whichDiv=event.srcElement;
menu1.style.leftPos+=10;
menu1.style.posLeft=event.clientX;
menu1.style.posTop=event.clientY;
menu1.style.display="";
menu1.setCapture();
}
//高亮显现鼠标移上是菜单的背景
functionswitchMenu(){
el=event.srcElement;
if(el.className=="menuItem"){
el.className="highlightItem";
}elseif(el.className=="highlightItem"){
el.className="menuItem";
}
}
//点击菜单响应项时触发响应的事务
functionclickMenu(){
menu1.releaseCapture();
menu1.style.display="none"; //点击后埋没菜单
el=event.srcElement;
if(el.id=="mnuRed"){
whichDiv.style.backgroundColor="red";
}elseif(el.id=="mnuGreen"){
whichDiv.style.backgroundColor="green"; //选择Green时背景变成绿色
}elseif(el.id=="mnuBlue"){
whichDiv.style.backgroundColor="blue";//选择blue时背景变成蓝色
}elseif(el.id=="mnuYellow"){
whichDiv.style.backgroundColor="yellow";//选择yellow时背景变成黄色
}
}
//-->
</SCRIPT>
<!--SAMPLE_STYLE_START-->
<LINKREL="stylesheet"HREF="/workshop/basicSDKIE4.CSS"TYPE="text/css">
<!--SAMPLE_STYLE_END-->
<LINKREL="stylesheet"TYPE="text/css"HREF="ms-help://Hx/HxRuntime/HxLink.css"><STYLETYPE="text/css">
PRE.clsCode{font-size:110%;}
PRE.clsSyntax{font-size:100%;}
TDDIV.clsBeta{display:none;}
MSHelp:link{
color:#0000ff;
text-decoration:underline;
cursor:hand;
hoverColor:#3366ff;
filterString:;}
</STYLE>
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
<BODYTOPMARGIN=0LEFTMARGIN=0BGPROPERTIES="FIXED"BGCOLOR="#FFFFFF"
LINK="#000000"VLINK="#808080"ALINK="#000000">
<BLOCKQUOTECLASS="body">
<!--CONTENTS_START-->
<H1>oncontextmenuEventSample</H1>
<P>Thissampleshowshowtousethe<B>oncontextmenu</B>eventhandler,availableinMicrosoft®InternetExplorer5andlater,todisplaybothstandardandcustomcontextmenusandpreventcontextmenusfromdisplaying.Experimentwitheachofthefollowingboxestoseehowyoucanapplydifferentmethodseithertodisplayortoinhibitcontextmenus.Eachboxprovidesinstructionsforyoutofollow.
</P>
<SPANclass="clickableSpan">
1.Thedefaultcontextmenualwaysdisplayswhenyouright-clickinthisbox.
<b><br>Code:</b>
//nocodenecessary
</SPAN><br><br>
<SPANclass="clickableSpan"oncontextmenu="returnevent.ctrlKey">
2.Thedefaultcontextmenudisplaysonlyifyouright-clickinthisboxwhileholdingdowntheCtrlkey.Thisisusefulfordevelopinganddebuggingpurposes.
<b><br>Code:</b>
oncontextmenu="returnevent.ctrlKey"
</SPAN><br><br>
<SPANclass="clickableSpan"oncontextmenu="re</p>asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。 |
|