|
|

楼主 |
发表于 2012/3/21 00:20:33
|
显示全部楼层
01.<style type="text/css">
02. .cMenu {
03. BORDER-RIGHT: #000000 1px solid;
04. BORDER-TOP: #000000 1px solid;
05. FONT-WEIGHT: normal;
06. FONT-SIZE: 14px;
07. VISIBILITY: hidden;
08. BORDER-LEFT: #000000 1px solid;
09. WIDTH: 150px;
10. CURSOR: default;
11. COLOR: #000000;
12. LINE-HEIGHT: 20px;
13. BORDER-BOTTOM: #000000 1px solid;
14. FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
15. POSITION: absolute;
16. BACKGROUND-COLOR: #eeeeff
17. }
18. .menuitems {
19. PADDING-RIGHT: 5px;
20. PADDING-LEFT: 5px
21. }
22.
23.</style>
24.<div id='contextMenu' class="cMenu"
25.style="position:absolute;left:100px;top:100px">
26.<DIV class=menuitems onclick="alert('查看历史执行情况');" onmouseover="highLightMenu()" onmouseout="LowMenu()">查看历史执行情况</DIV>
27. <DIV class=menuitems onclick="alert('查看批注');" onmouseover="highLightMenu()" onmouseout="LowMenu()">查看批注</DIV>
28. <DIV class=menuitems onclick="alert('插入/修改批注'); " onmouseover="highLightMenu()" onmouseout="LowMenu()">插入/修改批注</DIV>
29. <HR color=#aaaaaa size="0">
30. <DIV class=menuitems onclick="alert('关于');" onmouseover="highLightMenu()" onmouseout="LowMenu()">关于</DIV>
31.</div>
32.
33.<script language="javascript">
34.//自定义右键菜单对象
35.var contexMenu=document.getElementById('contextMenu');
36.//获取COGNOS对象后缀
37.function getPostFix()
38.{
39. var postFix;
40. postFix=document.getElementById('cv.id');
41. return postFix;
42.}
43.//隐藏COGNOS右键菜单
44.function hideContexMenu()
45.{
46. contexMenu.style.visibility="hidden";
47.}
48.
49.//显示cognos右键菜单
50.function showContexMenu()
51.{
52. contexMenu.style.visibility="visible";
53. //确定菜单显示位置
54. contexMenu.style.left=event.x;
55. contexMenu.style.top=event.y;
56. return clearCognosMenu();
57.}
58.
59.//强制清除自带右键菜单
60.function clearCognosMenu()
61.{
62. var postFix=getPostFix();
63. return eval("oCV"+postFix.value+".bCanUseCognosViewerContextMenu=false");
64.}
65.//高亮显示菜单
66.function highLightMenu()
67.{
68. var menuItem=event.srcElement;
69. if(menuItem.className="menuitems")
70. {
71. menuItem.style.backgroundColor="highlight";
72. menuItem.style.color="white";
73. }
74.}
75.
76.//不高亮显示
77.function LowMenu()
78.{
79. var menuItem=event.srcElement;
80. if(menuItem.className="menuitems")
81. {
82.
83. menuItem.style.backgroundColor="";
84. menuItem.style.color="black";
85.
86. }
87.}
88.
89.document.body.onload=clearCognosMenu;
90.document.body.onclick=hideContexMenu;
91.document.body.oncontextmenu=showContexMenu;
92.</script>
复制代码这是重写cognos右键菜单的js,你看下是不是你要的. |
|