我在cognos中生成了一些活动报告。然后,我在Cognos中使用JQuery:http://www.ibm.com/developerworks/library/ba-pp-reporting-advanced-report-design-page647/实现了这种动态报告
我用JQuery生成了一些交互式报告。但现在我想使用JQuery生成一个活动报告。我试过了,但没用。那么有没有办法在mht文件中使用JQuery呢?(因为活动报告以该格式存储)。
这是我在report studio的HTML项目中使用的代码:
<script type="text/javascript">
var j = jQuery.noConflict();
j(document).ready(function()
{
alert("hello");
j('.ShowHideMap').hide();
j('.ShowHideClicker').click(function()
{
j(this).next().toggle();
});
});
</script>
<div class="ShowHideClicker">Click here to show/hide the Map Report</div>
<div class="ShowHideMap">
Map comes here
</div>
我正在使用Firefox打开活动报表。当我打开报告,点击“点击这里显示/隐藏地图报告”,它并没有隐藏。
我拿起一个记事本,键入以下代码,并将其保存为"test.mht“
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
j(document).ready(function()
{
j('.ShowHideMap').hide();
j('.ShowHideClicker').click(function()
{
j(this).next().toggle();
});
});
</script>
</head>
<body>
<div class="ShowHideClicker">Click here to show/hide the Map Report</div>
<div class="ShowHideMap">
Map
</div>
</body>
</html>
啊,真灵。当我点击“单击此处以显示/隐藏地图报告”时,“地图”一词正在显示/隐藏。但是,当我在活动报表的HTML项中使用相同的代码时,报表不会显示/隐藏。
发布于 2019-07-16 02:42:58
这可能会有所帮助
https://bobsbiblog.wordpress.com/2014/08/25/creating-javascript-functions-in-active-reports/
这种技术的关键是标签,它是为数不多的包含onLoad事件的标签之一。只要显示图像,就会触发此事件。
在报表上的任何位置添加HTML项,只需确保它位于始终会呈现的位置(在页面上,但不是在任何平台内)。为HTML项提供以下文本:
<img src="hal/imagesirot/progress.gif" width="1" height="1" onload="
while( ! alert) {}
/* Define the function */
if (!document.testFunction ) {
testFunction = function() {
alert('We are running the test function');
}
}
/* Run any startup actions */
testFunction();
"/>https://stackoverflow.com/questions/30076901
复制相似问题