???
08-05-2007, 05:12 PM
These 2 lines are getting me:
frame.contentDocument.getElementsByTagName ("html") [0].innerHTML = theXML;
alert (frame.contentDocument.getElementsByTagName ("html") [0].innerHTML);
It doesn't appear on screen, but then the alert says what I want it to say.
The entire code is:
<html>
<head>
<script type="text/javascript">
window.onload = function () {
for (var i = 0; i < document.getElementsByTagName ("xml").length; i = i + 1) {
var tag = document.getElementsByTagName ("xml") [i];
var theXML = "<?" + tag.getAttribute ("doctype") + "?>" + tag.innerHTML;
tag.innerHTML = "";
var frame = document.createElement ("iframe");
frame.setAttribute ("src","about:blank");
tag.appendChild (frame);
frame.contentDocument.getElementsByTagName ("html") [0].innerHTML = theXML;
alert (frame.contentDocument.getElementsByTagName ("html") [0].innerHTML);
}
}
</script>
</head>
<body>
<xml doctype='version="1.0" encoding="ISO-8859-1"'>
<root>
hahaha
</root>
</xml>
</body>
</html>
I did it before with it writing about:blank, but right now I can't figure out whats wrong.
frame.contentDocument.getElementsByTagName ("html") [0].innerHTML = theXML;
alert (frame.contentDocument.getElementsByTagName ("html") [0].innerHTML);
It doesn't appear on screen, but then the alert says what I want it to say.
The entire code is:
<html>
<head>
<script type="text/javascript">
window.onload = function () {
for (var i = 0; i < document.getElementsByTagName ("xml").length; i = i + 1) {
var tag = document.getElementsByTagName ("xml") [i];
var theXML = "<?" + tag.getAttribute ("doctype") + "?>" + tag.innerHTML;
tag.innerHTML = "";
var frame = document.createElement ("iframe");
frame.setAttribute ("src","about:blank");
tag.appendChild (frame);
frame.contentDocument.getElementsByTagName ("html") [0].innerHTML = theXML;
alert (frame.contentDocument.getElementsByTagName ("html") [0].innerHTML);
}
}
</script>
</head>
<body>
<xml doctype='version="1.0" encoding="ISO-8859-1"'>
<root>
hahaha
</root>
</xml>
</body>
</html>
I did it before with it writing about:blank, but right now I can't figure out whats wrong.