First, snippets of the original code that was working with no problem:
XML first:
Expand|Select|Wrap|Line Numbers
- <title>bla bla</title>
- <music id="newepisode">bla bla bla</music>
- <details>
- <TABLE BORDER=0 WIDTH="100%">
- <th>
- Featured Band
- </th>
- <tr>
- <td>
- something data here...
- </td>
- </tr>
- </table>
- </details>
- <music>bla bla bla</music>
Of course, after the try & catch xmlhttprequest with all the conditionals for the three types of browsers:
Expand|Select|Wrap|Line Numbers
- artistdetails = xml_doc.getElementsByTagName("details");
Expand|Select|Wrap|Line Numbers
- document.writeln('<div id="divContainer" style="overflow:auto;"> ');
- document.writeln('<div id="divContent"> ');
- document.writeln('<p class="pscoll">');
- <!-- a list of links to click on which would call the following function -->
- document.writeln('</p>');
- document.writeln('</div>');
- document.writeln('</div>');
- document.writeln('<div id="extraDetails" class="extraDetails"><span></span></div>');
- document.writeln('<div id="extraDetails2" class="extraDetails2"><span></span></div>');
- function myInsertTheDetailsFunction(l)
- {
- div = document.getElementById("extraDetails");
- div.innerHTML = "";
- myDetailsArray[l] = artistdetails[l].childNodes[0].nodeValue;
- div.innerHTML = myDetailsArray[l];
- }
Expand|Select|Wrap|Line Numbers
- <title>bla bla bla</title>
- <music id="newepisode" ></music>
- <details>
- <![CDATA[<TABLE BORDER=0 WIDTH="100%">
- <th>
- Featured Band
- </th>
- <tr>
- <td>
- some data here...
- </td>
- </tr>
- </table>]]>
- </details>
- <music></music>
Expand|Select|Wrap|Line Numbers
- artistdetails = xml_doc.getElementsByTagName("details");
Expand|Select|Wrap|Line Numbers
- <!-- a list of links to click on which would call the following function IS NOW POPULATED BY innerHTML -->
- someVar4FeaturedArtist = artistdetails[k].childNodes[0].data
- function myInsertTheDetailsFunction(l)
- {
- div = document.getElementById("extraDetails");
- div.innerHTML = "";
- myDetailsArray[l] = artistdetails[l].childNodes[0].nodeValue;
- div.innerHTML = myDetailsArray[l];
- }
Why?
The same div is there from the beginning before anything is called or done. If anyone can point me to some examples or tutorials that have examples of retrieving CDATA from XML and then using Javascript to display the contents of the CDATA data, then it would be appreciated greatly.
Thanks in advance