html的iframe页面给帆软BI发送消息

需求:帆软的网页组件嵌套一个HTML页面,HTML页面要给帆软发消息。

解决方法是:fineReportWindow.duchamp.getWidgetByName("txt1").setValue('666');

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>HTML Page for FineReport</title>

</head>

<body>

<button id="sendButton">发送消息</button>

<script>

// 获取按钮元素

var sendButton = document.getElementById('sendButton');

// 向帆软发送消息的函数

function sendMessageToFineReport(message) {

// 假设 parent 是帆软的窗口对象,这里需要根据实际情况修改

var fineReportWindow = parent;

// 使用 postMessage 发送消息

fineReportWindow.postMessage(message, {});

fineReportWindow.XXX=1;

console.log(fineReportWindow);

fineReportWindow.duchamp.getWidgetByName("下拉框1_页面1").setValue('87897232');

//window.postMessage(message, '*');

}

// 监听按钮点击事件

sendButton.addEventListener('click', function() {

sendMessageToFineReport('999');

});

</script>

</body>

</html>

注意不要跨域,html页面可以丢到帆软的安装目录下。这样就同一个域名了

相关推荐
Enti7c4 分钟前
Cookie可以存哪些指?
javascript
inxunoffice29 分钟前
批量在多个 PDF 的指定位置插入页,如插入封面、插入尾页
前端·pdf
木木黄木木34 分钟前
HTML5 Canvas绘画板项目实战:打造一个功能丰富的在线画板
前端·html·html5
ElasticPDF_新国产PDF编辑器35 分钟前
React 项目 PDF 批注插件库在线版 API 示例教程
javascript
豆芽81936 分钟前
基于Web的交互式智能成绩管理系统设计
前端·python·信息可视化·数据分析·交互·web·数据可视化
不是鱼36 分钟前
XSS 和 CSRF 为什么值得你的关注?
前端·javascript
顺遂时光40 分钟前
微信小程序——解构赋值与普通赋值
前端·javascript·vue.js
anyeyongzhou42 分钟前
img标签请求浏览器资源携带请求头
前端·vue.js
Captaincc1 小时前
腾讯云 EdgeOne Pages「MCP Server」正式发布
前端·腾讯·mcp
最新资讯动态1 小时前
想让鸿蒙应用快的“飞起”,来HarmonyOS开发者官网“最佳实践-性能专区”
前端