Jump to content

XML DOM & getElementByID()


AhtUrghan

Recommended Posts

XML File:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE organization [	<!ELEMENT organization (department+)>	<!ELEMENT department (#PCDATA)>	<!ATTLIST department id ID #REQUIRED>	]><organization>	<department id="BOB Programs">BOB Programs</department>	<department id="LME">LME Programs</department></organization>

Web Page:

<html><head><script type="text/javascript"for="window" event="onload">	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");	xmlDoc.async="false";	xmlDoc.load("org.xml");<!--                //Error Occurs on following line -->	var nodes = xmlDoc.documentElement.getElementById("LME");	if(nodes==null) {		department.innerText="Screw It";	} else {		department.innerText = nodes(0).text;	}</script></head><body><b>Department Name:</b><span id="department"> </span><br/></body></HTML>

Using IE6. I get the error: Object doesnt support this property or method at the indicated line.I know I'm doing something simple wrong, what is it?

Edited by aspnetguy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...