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页面可以丢到帆软的安装目录下。这样就同一个域名了

相关推荐
IT_陈寒20 分钟前
JavaScript项目实战经验分享
前端·人工智能·后端
用户47949283569151 小时前
6w star,GitHub 趋势第一的 Ponytail,这个agent插件到底在火什么
前端·后端
薛定喵的谔2 小时前
我开源了一个精致的 Next.js 博客模板:Skyplume
前端·前端框架·next.js
张龙6873 小时前
构建生产级 AI Agent:工具调用与记忆架构实战指南
前端
kyriewen4 小时前
2026 年了,还在用 Node.js?Bun 迁移实战:20 分钟搞定,附踩坑记录
前端·javascript·node.js
青山Coding6 小时前
Cesium应用(八):物体运动的实现思路
前端·cesium
用户41659673693556 小时前
Android WebView 加载 file:// 离线页面调试教程
android·前端
Asmewill6 小时前
curl命令学习笔记一
前端
我是一只快乐的小螃蟹6 小时前
1.2 ArrayList 源码解析
前端
星栈6 小时前
我用 Rust + Dioxus 做了个全栈跨平台笔记应用:再把新建、编辑和交付补上
前端·rust·前端框架