help with DOM and JS

admin

Administrator
Staff member
HI I'm new to this stuff and was reading some tutorials on formating xml into html it seemed to be going pretty good but now Im having some problems when trying to use JS to fillter the results. can som one look at my code and point me in the right direction. thanks

<html>
<head>

<script type="text/javascript">

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("BB_CAST.xml")

var z = xmlDoc.getElementsByTagName("PERSON")
var x = xmlDoc.getElementsByTagName("NAME")
var y = xmlDoc.getElementsByTagName("BIO")

for (i = 0; i <= x.lenght; i++)
{
if (z.item(i-1).getAttribute("ID") = "1")
{
name.innerText = x.item(i-1).text

bio.innerText = y.item(i-1).text

}
}
</script>

<title></title>
</head>
<body>

<h1>cast</h1>

<b>Name: </b>
<span id="name"> </span>
<br />
<b>Bio: </b>
<span id="bio"></span>

</body>
</html>
 
Back
Top