日期:2014-05-17 浏览次数:20647 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>sdf </title>
<style type="text/css">
html,body{margin:0px;padding:0px;width:100%;height:100%;font-size:12px;overflow:show;}
#cmenu{border:1px solid #5EB4D8;background-color:#F6F9FD;padding:2px;}
ul,li{list-style:none;margin:0px;padding:0px;}
.item{list-style:none;margin:0px;padding:0px;height:23px;line-height:23px;display:block;padding:0px;padding-left:10px;}
.itemOver{background-color:#68B5EA;color:#fff;cursor:default;}
.separator{width:100%;height:1px;line-height:1px;overflow:hidden;font-size:1px;background-color:#5EB4D8;margin:1px 0px 1px 0px;padding:0px;}
.contextDiv{position:absolute;border:1px solid #cccccc;width:150px;height:100px;background-color:#EFECDD;}
</style>
<script type="text/javascript">
<!--
/**
* author: yswang
* version: 1.2
* date: 2008-08-15
* mail: [email]wangys0927@163.com[/email]
*/
// 获取对象
function $o(id){return document.getElementById(id); }
// 获取目标元素
function getElement(evt){ evt = evt ||window.event; return (evt.srcElement || evt.target);}
// 鼠标X坐标
function positionX(evt){evt = evt || window.event; return (evt.x || evt.clientX || evt.pageX);}
// 鼠标Y坐标
function positionY(evt){evt = evt || window.event; return (evt.y || evt.clientY || evt.pageY);}
// 清除事件冒泡和传递影响
function clearEventBubble(evt){
evt = evt || window.event;
if(evt.stopPropagation) evt.stopPropagation(); else evt.cancelBubble = true;
if(evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
}
// 事件绑定
function addEvent(actionEvents,eventObj){
eventObj = eventObj || document;
if(window.attachEvent){
for(var actionType in actionEvents){
eventObj.attachEvent("on"+actionType,actionEvents[actionType]);
}
}
if(window.addEventListener){
for(var actionType in actionEvents){
eventObj.addEventListener(actionType,actionEvents[actionType],false);
}
}
}
document.oncontextmenu = function(){return false; }
// 右键菜单
function contextMenu(initProps,bindingEvents){
this._contextMenu = null; // 右键菜单体
this._contextMenuId = initProps["contextMenuId"]; // 待加载右键菜单的对象
this._targetElement = initProps["targetElement"]; // 右键菜单目标
this._funcEvents = bindingEvents.bindings; // 绑定的事件配置信息
this._menuItems = null; // 菜单项
// 浏览器类型判断
this._isIE = function(){return navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && document.all};
}
// 初始化右键菜单功能
contextMenu.prototype.buildContextMenu = function(){
// 获取菜单对象
this._contextMenu = $o(this._contextMenuId);
this._contextMenu.style.top ="-1000px";
this._contextMenu.style.left="-1000px";
this._contextMenu.style.display = "none";
// 阻止菜单的点击事件上传到doc