Jump to content

unreal

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by unreal

  1. Hi all,I've searched the forums already but did not find anything that really answers this.So the way W3cschool teaches to get a value of an element shown is like such

    function getmessage(){document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;

    and then we do a

    <p><span id="to"></span>

    But how do I go about display 2 or more of values from different nodes of the elements with the same tag?W3cschool uses this method

    // documentElement always represents the root nodevar x=doc.documentElement;document.write("Text of first child element: ");document.write(x.childNodes[0].childNodes[0].nodeValue);document.write("<br />");document.write("Text of second child element: ");document.write(x.childNodes[1].childNodes[0].nodeValue);</script>

    That would work but how do i go about having to output by using <SPAN id> ? and not using document.write in Java.That would be more flexible when it comes to dealing with css as well.Do i do a var=secondnode=document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;actually i tried that.. din't work.Hope to see some help .. Thanks in advance

  2. Hi All,I have used the search function and tried looking for a solution b4 posting. I did obtain some help but i'm still left with one problem.I'm trying to build a custom rss reader from feeds generated from windows sharepoint services. In the description element, they use Cdata..

     <description><![CDATA[<div><b>Body:</b> <div class=ExternalClassBFCE56CD2A8F4E2BAF13C24F0AC00BEF><div>Test 1 2 3</div></div></div>]]></description>

    I've tried using many ways (started with http://www.w3schools.com/dom/tryit.asp?fil...dom_cdata_data) to output the contents from CDATA but still failed.Values from all other elements (which are non cdata) worked fine.by using

     document.getElementById("author").innerHTML=xmlDoc.getElementsByTagName("author")[1].childNodes[0].nodeValue;

    is there a specific way to do this? Having able to use the id. instead of the document.write in the example given.Any help will be greatly appreciated!!Thanks.

×
×
  • Create New...