Hi,
I am just trying to get the node value from the xml file "books.xml" .
I am getting error: Object Required at line 12.
What can be the solution for this???
This is my script
<HTML>
<HEAD>
</HEAD>
<body>
<script type="text/javascript">
xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async=fa lse;
xmlDoc.load("bo oks.xml");
x=xmlDoc.getEle mentsByTagName( "price")[0].childNodes[0];
document.write( x.nodeValue);
</script>
</body>
</HTML>
*************** *************** *************** *************** ********
and books.xml code is
<?xml version="1.0" encoding="ISO-8859-1" ?>
<bookstore>
<book category="COOKI NG">
<title lang="en">Every day Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILD REN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
I am just trying to get the node value from the xml file "books.xml" .
I am getting error: Object Required at line 12.
What can be the solution for this???
This is my script
<HTML>
<HEAD>
</HEAD>
<body>
<script type="text/javascript">
xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async=fa lse;
xmlDoc.load("bo oks.xml");
x=xmlDoc.getEle mentsByTagName( "price")[0].childNodes[0];
document.write( x.nodeValue);
</script>
</body>
</HTML>
*************** *************** *************** *************** ********
and books.xml code is
<?xml version="1.0" encoding="ISO-8859-1" ?>
<bookstore>
<book category="COOKI NG">
<title lang="en">Every day Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILD REN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
Comment