陋室铭
永远也不要停下学习的脚步(大道至简至易)

posts - 2169,comments - 570,views - 413万

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="

右键菜单.aspx.cs" Inherits="右键菜单" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1

-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script language='javascript'>
/*******以下内容可以修改***************/
var mname=new Array(
"首  页",
"修  改",
"下  载",
"删  除",
"新  建",
"刷  新"
);
//mname是菜单对应的名称,数组的个数必须与下面murl对应

var murl=new Array(
"window.open('http://www.cn5.cn','_blank','');",
"alert('修改');",
"alert('download');",
"alert('delete');",
"alert('new');",
"alert('refresh');"
);
//murl是菜单对应的操作,可以是任意javascript代码但是要注意

不要在里面输入\",只能用'
//如果要实现跳转可以这样window.location='url'; 
var ph=18,mwidth=50;//每条选项的高度,菜单的总宽度
var bgc="#eee",txc="black";//菜单没有选中的背景色和文字色
var cbgc="darkblue",ctxc="white";//菜单选中的选项背景色和

文字色

/****************以下代码请不要修改******************/
var

mover="this.style.background='"+cbgc+"';this.style.color='

"+ctxc+"';"
var

mout="this.style.background='"+bgc+"';this.style.color='"+

txc+"';"

//页面鼠标右键事件
document.oncontextmenu=function()

 mlay.style.display="";
 mlay.style.pixelTop=event.clientY;
 mlay.style.pixelLeft=event.clientX;
 return false;
}
function showoff()
{
 mlay.style.display="none";
}

function fresh()
{
 mlay.style.background=bgc;
 mlay.style.color=txc;
 mlay.style.width=mwidth;
 mlay.style.height=mname.length*ph;
 var h="<table width=100% height="+mname.length*ph+"px

cellpadding=0  cellspacing=0 border=0>";
 var i=0;
 for(i=0;i<mname.length;i++)
 {
  h+="<tr align=center height="+ph+" onclick=\""+murl[i]

+"\" onMouseover=\""+mover+"\" onMouseout=\""+mout+"\"><td

style='font-size:9pt;'>"+mname[i]+"</td></tr>";
 }
 h+="</table>";
 mlay.innerHTML=h;
}
</script>

</head>
<body onClick="showoff();" onload="fresh();">
    <form id="form1" runat="server">
    <div id="mlay"

style="position:absolute;display:none;cursor:default;" 

onClick="return false;">6786786</div>
    </form>
</body>
</html>

 

posted on   宏宇  阅读(398)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
< 2007年9月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6

点击右上角即可分享
微信分享提示