Hi,
i'm new to using mathjax and mathml. Can anyone please send me a
sample code for rendering dynamic mathml?
The below code works with firefox but throws an error with chrome
saying "Uncaught SyntaxError: Unexpected token < "
CODE:
<html>
<head>
<title>Interactive MathML display</title>
<script src="
http://cdn.mathjax.org/mathjax/latest/MathJax.js?
config=MML_HTMLorMML-full">
MathJax.Hub.Config({
extensions: ["mml2jax.js"],
MMLorHTML: { prefer: "HTML" } ,
jax: ["input/MathML", "output/HTML-CSS"]
});
</script>
</head>
<body>
<script>
(function () {
var QUEUE = MathJax.Hub.queue;
var math = null;
QUEUE.Push(function () {
math = MathJax.Hub.getAllJax("MathOutput")[0];
});
window.ShowMath = function (MathML) {
QUEUE.Push(["Text",math,MathML]);
}
})();
</script>
<input type="button" onclick="ShowMath(<math>
<mi>x</mi> <mo>=</mo>
<mrow>
<mfrac>
<mrow>
<mo>−</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<msup><mi>b</mi><mn>2</mn></msup>
<mo>−</mo>
<mn>4</mn><mi>a</mi><mi>c</mi>
</msqrt>
</mrow>
<mrow> <mn>2</mn><mi>a</mi> </mrow>
</mfrac>
</mrow>
<mtext>.</mtext>
</math>)" value="Show" id="MathInput" />
<p>
<div id="MathOutput">
Formula: <math></math>
</div>
</body>
</html>
Please correct my code or send a new sample code.
I am given a project which is render a formula suggestion feature
whihc will suggest math formula. So i shud find a way of remembering
formula and rendering them dynamicaaly on the fly. Kindly suggest
ideas.
Please help me immediately. i have been stuck for the lst 2 weeks
Thanks.
Iswarya