题
我试图使用MathJax将文本转换成数学在打字时,使用textarea的领域。然而,当我把输入的文本到一个数据库检索通过一个PHP文件恢复到原来的文件中的文本,我不能让MathJax到文本转换成乳液状的符号。
这是主要部分(使用jQuery):
$(document).ready(function(){
$('textarea').keydown(function(){
dynamic(); \\ A function described in MathJax documentation to load dynamically
var text = $('textarea').val();
$.post('process.php',{ input: text } );
$("#unload").load('fetch.php');
});
});
其中动态()被定义为(从加载MathJax动态采取):
function dynamic(){var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://miql.zxq.net/MathJax/MathJax.js";
var config = 'MathJax.Hub.Config({ config: "MathJax.js" }); ' +
'MathJax.Hub.Startup.onload();';
if (window.opera) {script.innerHTML = config}
else {script.text = config}
document.getElementsByTagName("head")[0].appendChild(script);
};
此外,我有楷书到MathJax其中工程好吗但使用onload事件。
我觉得我得到错误的指令动态加载MathJax。什么是做了正确的方法是什么?任何帮助将不胜感激。
解决方案
这听起来像你要修改的页面上数学。看到 http://www.mathjax.org/resources/docs/?typeset.html一>
还请参阅演示页在 http://mathjax.org/mathjax/test/sample-dynamic.html
不隶属于 StackOverflow