Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to display xml document without using alert("")

    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?

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,459
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •