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

相关推荐
开开心心_Every3 分钟前
安卓做菜APP:家常菜谱详细步骤无广简洁
服务器·前端·python·学习·edge·django·powerpoint
前端_Danny5 分钟前
用 ECharts markLine 实现节假日标注
前端·信息可视化·echarts
古城小栈7 分钟前
Rust 丰富&好用的 格式化语法
前端·算法·rust
丢,捞仔17 分钟前
uni-app上架应用添加权限提示框
前端·javascript·uni-app
Glink23 分钟前
从零开始编写自己的AI账单Agent
前端·agent·ai编程
Hilaku23 分钟前
我是如何用一行 JS 代码,让你的浏览器内存瞬间崩溃的?
前端·javascript·node.js
努力犯错玩AI23 分钟前
如何在ComfyUI中使用Qwen-Image-Layered GGUF:完整安装和使用指南
前端·人工智能
Lefan26 分钟前
在浏览器中运行大模型:基于 WebGPU 的本地 LLM 应用深度解析
前端
五仁火烧26 分钟前
npm run build命令详解
前端·vue.js·npm·node.js
哈__28 分钟前
React Native 鸿蒙跨平台开发:简易记事本 APP
javascript·react native·react.js