【发布时间】:2015-03-02 03:50:46
【问题描述】:
我试图通过点击事件在 iFrame 上调用 MathJax 函数。这是代码
html
<body onLoad="ifon();">
<iframe name="richTextField" id="richTextField" style="border:#000000 1px solid; width:700px; height:300px;"></iframe>
<button onclick="refresh();"></button>
</body>
javascript
function ifon(){
richTextField.document.designMode = 'On';
}
function refresh(){
var richTextField = document.getElementById("richTextField");
if(richTextField != null) {
var get_iframe_text = richTextField.contentWindow.document.body.innerHTML;
if(get_iframe_text.slice(-6) == "$$<br>"){
//Trying to call MathJax on iFrame
MathJax.Hub.Queue(["Typeset",MathJax.Hub,richTextField]);
alert("Success");
}
}
}
仅当最后六个字符为$$<br>时才会执行嵌套if条件的refresh()
谁能帮我在 iFrame 上调用 MathJax.Hub.Queue([]) 吗?
【问题讨论】:
标签: javascript jquery html iframe mathjax