javascript - 我可以在 WSO2 ESB 6.5 的脚本中介中使用 appendChild 或其他函数吗?
问题描述
我正在尝试在 html 中构建有效负载以发送电子邮件。我正在使用脚本调解器,但如果条件为真,我想附加一个孩子。
<script language="js">
<![CDATA[var payload = <html>
<div id="main">
<div>
......
</div>
<div>
.......
</div>
</div>
</html>;
var child = <div>
....
</div>
if(true){
payload.getElementById("main").appendChild(child);
}
mc.setPayloadXML(payload);]]>
</script>
我曾尝试使用 appendChild(html 片段),但出现下一个错误:
引起:org.mozilla.javascript.EcmaError:TypeError:在对象中找不到函数getElementById
如何将孩子附加到 div?
谢谢
解决方案
推荐阅读
- typescript - 使用bind时如何对this的typescript类型说?
- android - 如何在 Android Studio 中禁用 lambda 功能?
- python - 简单的加法问题在python中不起作用
- python - Matplotlib:如何只显示一个图形而不关闭其他图形?
- javascript - 从我的桌面复制 S3 存储桶文件后未显示
- reactjs - 更改第 3 方组件的背景颜色而不更改其代码
- ios - 如果我使用工具栏,UISplitViewController 的颜色显示不正确
- flutter - Flutter,从函数中显示 AlertDialog
- python - 使用 Python 创建数字组合并获取不同组合的计数
- selenium - 使用 maven 依赖项 - 来自 bonigarcia 的 WebDriverManager 是否有任何副作用?