|
Posted by DKM on May 16, 2005, 5:35 am
Please log in for more thread options
DKM wrote:
> I need an equivalent for the following:
>
> document.getElementById('equation').update(); from Mathplayer
>
> to use it in Mozilla based browser.
>
> When I change any text node, the page updates just fine in FireFox.
> However, if I change an entire math element, as in the following:
>
> eqElement = document.getElementById("equation");
> a2Element = document.createElement("msup");
> baseElement = document.createElement("mi");
> powerElement = document.createElement("mo");
> baseElementText = document.createTextNode("a");
> powerElementText = document.createTextNode("2");
> baseElement.appendChild(baseElementText);
> powerElement.appendChild(powerElementText);
> a2Element.appendChild(baseElement);
> a2Element.appendChild(powerElement);
> eqElement.appendChild(a2Element);
>
>
> it does not update the page.
A little correction here. It updates the math element. But, it does not
display it mathematically.
Starting from
<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML"> </math>
I get the following:
<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML"> <msup>
<mi>a</mi>
<mn>2</mn>
</msup>
</math>
Which is what I wanted. But, the browser does not display the math.
D.K. Mishra
>
> It does not update in Internet Explorer running Mathplayer either.
> However, if I follow up the above code with the following:
>
> document.getElementById('equation').update();
>
> it works just fine.
>
> The file is a XML file with the following declaration:
>
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
> "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"
> [<!ENTITY mathml
"http://www.w3.org/1998/Math/MathML">
> ]>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> I will appreciate it if someone can she some light on this.
>
> Thanks in advance.
>
> D. K. Mishra
|