Heyho,
I have a problem: I made a window handler class. It is great and I am very proud of itbut there is the problem that it now runs the document.write function although I'd like to run it in a spontaneous call in the context and not every time at the end of the document. I tried to use that loadXMLString function of the w3c but it doesn't work.
Here's a short example:
call:Code:function VirtualWindows() { this.putContent = function(windowcontent) { var content = this.loadXMLString(windowcontent); var mainbody = document.getElementsByTagName("body")[0]; mainbody.appendChild(content.documentElement); }; this.loadXMLString = function(txt) { try { //Internet Explorer xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(txt); return(xmlDoc); } catch(e) { try { //Firefox, Mozilla, Opera, etc. parser = new DOMParser(); xmlDoc = parser.parseFromString(txt,"text/xml"); return(xmlDoc); } catch(e) { alert(e.message); } } return(null); }; }
Why doesn't this work? If I try alert(content.documentElement.nodeName); at the end of the putContent() function "div" appears but I cannot get the class, there is no possibility to implement it in the document and nothing else works.Code:var windowmanager = new VirtualWindows(); windowmanager.putContent('<div class="testmessage">hey, I am a test. What do you are? <div><span>I am a child element that only has one parent</span></div><div></div></div>');
Please, help!!!
greetings
Max



but there is the problem that it now runs the document.write function although I'd like to run it in a spontaneous call in the context and not every time at the end of the document. I tried to use that loadXMLString function of the w3c but it doesn't work. 
Reply With Quote
. Anyway, it doesn't work! Waaaaah
That's how it works, too!
Bookmarks