...

View Full Version : how to display xml document without using alert("")



flyclassic
09-13-2002, 04:20 AM
var objDOM;
objDOM = new ActiveXObject("MSXML.DOMDocument");
objDOM.async = False;
objDOM.load("aflooding.xml");
alert(objDOM.xml);

my script is as follow , i would like to display my XML file. I've read up from some books and it always uses Alert(objDOM.xml), but i would like a direct output to the page instead of a popup.
Is there anyway you guys now?

Alex Vincent
09-14-2002, 07:23 PM
How about opening a popup window?

var popup=window.open("","")
popup.document.write("<pre><![CDATA["0
popup.document.write(objDOM.xml.toString())
popup.document.write("]]></pre>")
popup.document.close()

The browser may not like the <![CDATA[...]]> tags. If it doesn't, try <xmp>...</xmp>.

Another option is a textarea.

var popup = window.open("","")
popup.document.write("<html><head><title></title></head>")
popup.document.write("<body><form><textarea cols='60' rows='30'>")
popup.document.write(objDOM.xml.toString())
popup.document.write("</textarea></form></body></html>")
popup.document.close()

Finally, you could use a textarea directly in your master page.

document.forms.formName.textAreaName.value = objDOM.xml.toString()

HTH :cool:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum