|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (2 bit)
Join Date: Oct 2006
Posts: 2
|
I'm trying to display text/data from an XML file onto an HTML file using JavaScript.
When I display the XML without using JavaScript, it will retain how it was "formatted" in XML. When I use JavaScript to retrieve and display the XML, it doesn't. I need to find out how to fix this..... Example (this works): Code:
[span datasrc="#eMaps" datafld="ClickOn" id="ClickOn"][/span] Example (this doesn't work): Code:
[script type="text/javascript"]
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function loadXML(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
}
function verify()
{
// 0 Object is not initialized
// 1 Loading object is loading data
// 2 Loaded object has loaded data
// 3 Data from object can be worked with
// 4 Object completely initialized
if (xmlDoc.readyState != 4)
{
return false;
}
}
loadXML('eMaps.xml');
function showText(box)
{
var s = "";
var h = "";
switch(box)
{
case 2:
s=(xmlObj.childNodes(1).text);
h="Opening";
break;
case 3:
s=(xmlObj.childNodes(3).text);
h="Reason";
break;
default:
s=(xmlObj.childNodes(0).text);
break;
}
ClickOn.innerHTML=s;
header.innerHTML=h;
}
[/script]
Last edited by nickdmoore; 10-27-2006 at 10:07 PM. |
|
|
|
|
|
#2 |
|
Member (2 bit)
Join Date: Oct 2006
Posts: 2
|
Nevermind - found a solution. Thanks
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sometimes my router just doesn't reconnect. | indigo0086 | Networking & Online Security | 10 | 07-26-2006 10:51 AM |
| Same old issue...can't find my CD Rom.. | Powerstroke2000 | Computer Hardware | 6 | 02-09-2006 07:43 PM |
| Aol connection issue | bdanner302 | Networking & Online Security | 3 | 01-09-2005 12:04 AM |
| Unusual issue with WMP | scomac | Software Discussion & Support | 0 | 09-04-2004 07:48 AM |
| Intermittent power issue | Kean | Computer Hardware | 6 | 06-14-2002 05:42 PM |