日期:2014-05-17 浏览次数:20437 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>自定义鼠标右键</title>
<script language="javascript" type="text/javascript">
document.oncontextmenu = function () {
var div = document.getElementById("hdiv");
div.style.pixelLeft = event.clientX;
div.style.pixelTop = event.clientY;
div.style.display = "block";
return false;
}
</script>
</head>
<body>
<div id="hdiv" align="center" style="position:absolute; display:none; background-color:#EFF8FF; height:100px; width:100px; top:0px; left:0px; ">
<fieldset style="border-color:#96C2EF; border-width:1px; border-style:solid;">
<legend>总控表</legend>
<table width="100%" bgcolor="#ECE9D8" style="cursor:pointer;">
<tr onmouseover="this.bgColor='FFFFFF'" onmouseout="this.bgColor='#ECE9D8'">
<td align="center" onclick="hdiv.style.display='实时数据'" >实时数据</td>
</tr>
<tr onmouseover="this.bgColor='FFFFFF'" onmouseout="this.bgColor='#ECE9D8'">
<td align="center" onclick="hdiv.style.display='历史数据'" >历史数据</td>
</tr>
<tr onmouseover="this.bgColor='FFFFFF'" onmouseout="this.bgColor='#ECE9D8'">
<td align="center" onclick="hdiv.style.display='关闭菜单'">关闭菜单</td>
</tr>
</table>
</fieldset>
</div>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Web1.WebForm1" %>
<!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></title>
<script language="javascript" type="text/javascript">
document.oncontextmenu = function () {
var div = document.getElementById("hdiv");
&