I am trying to append the contents of the <message> tag in an XML document to an iframe using the XML DOM.
Here's the code I have:
Expand|Select|Wrap|Line Numbers
- var message = msgsfile.getElementsByTagName("message")[msg]
- .firstChild.nodeValue;
- alert(message);
- var writemsg = parent.frames['msgframe'];
- var writedoc = writemsg.document;
- var writebody = writemsg.getElementsByTagName("body")[0];
- writebody.appendChild(writedoc.createTextNode(message));
Although the message appears fine in my alert, it is not being placed in the iframe. What have I done wrong?
Thanks in advance.