Home >Web Front-end >JS Tutorial >Use JS to rewrite the implementation code of Cognos right-click menu_javascript skills

Use JS to rewrite the implementation code of Cognos right-click menu_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:29:521298browse
Copy code The code is as follows:


< ;STYLE type=text/css>
.cMenu {
BORDER-RIGHT: #000000 1px solid;
BORDER-TOP: #000000 1px solid;
FONT-WEIGHT: normal;
FONT-SIZE: 14px;
VISIBILITY: hidden;
BORDER-LEFT: #000000 1px solid;
WIDTH: 150px;
CURSOR: default;
COLOR: #000000;
LINE-HEIGHT: 20px;
BORDER-BOTTOM: #000000 1px solid;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
POSITION: absolute;
BACKGROUND-COLOR: # eeeeff
}
.menuitems {
PADDING-RIGHT: 5px;
PADDING-LEFT: 5px
}











Let me introduce this code below. The previous style and div mainly define the actual style of the menu. There is a clickcall attribute in the div whose reference style is menuitems. This attribute is called when this menu item is clicked. JS function, you can change it to your own function. I just simply called alert here.
There is an object of cv.id in the getObjectName function. Someone has asked this question before, what is "cv.id" used for? The names of the objects generated by running cognos reports in ReportStudio are different from those generated by URL requests, but there are rules to follow. For example, the object name of CognosViewer in the report generated by running ReportStudio is oCVRS, while the name of the cognosViewer object generated by using URL requests is oCVRS. It is called oCV_NS_. You can view the source files of the two running results to compare, which is more intuitive. It is found that the prefixes are the same (oCV), but the "RS" and "_NS_" behind them are different. Many objects in the page use this rule, and cv.id is stored with the suffix. This way you can piece together the object name in the current running mode.
The getRVContent function obtains the DIV object with the ID of RVContent_NS_ or RVContentRS. RVContent displays the content of the report defined using ReportStudio, and does not include the CognosViewer toolbar and title bar.
The overWriteRightClick function changes the function called by cognos right-click to a self-defined function.
The disableRightClick function has already been mentioned, disabling the right-click menu.
The functions displayContextMenu, hideContextMenu, highLightMenu, and lowLightMenu are all related to menu operations and can be modified according to actual requirements.
The rendering is as follows:
Use JS to rewrite the implementation code of Cognos right-click menu_javascript skills
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn