Jan Odvarko wrote:


how can I dynamically inject an HTML into an existing XUL page by JavaScript?

I have tried following but it doesn't work:

<description>
        <html:div id="HtmlResult"/>
</description>

var innerHTML = "<b>Test</b>";
var result = document.getElementById("HtmlResult");
result.innerHTML = innerHTML;

You can use Core DOM stuff like var b = document.createElementNS('http://www.w3.org/1999/xhtml', 'b'); b.appendChild(document.createTextNode('Test')); result.appendChild(b);

Perhaps you can even use DOMParser e.g.

var domParser = new DOMParser();
var doc = domParser.parseFromString('<b xmlns="http://www.w3.org/1999/xhtml";>Kibology for all.<\/b>', 'application/xml');


result.appendChild(result.ownerDocument.importNode(doc.documentElement, true));

but I haven't tried that in XUL.
--

        Martin Honnen
        http://JavaScript.FAQTs.com/
_______________________________________________
mozilla-layout mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-layout

Reply via email to