Advertisement
Advertisement
| 05.13.2008 at 08:05AM PDT, ID: 23398070 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: |
<script type="text/javascript">
//call the included parseXML function above
parseXML("/inc/pla/glossary.xml");
//find out how many <term> tags in the glossary.xml file
noOfTerms = xmlhttp.getElementsByTagName("glossary")[0].getElementsByTagName("term").length;
//loop through them to find one with a name that matches the nameOfTerm
for (var i=0; i<noOfTerms; i++) { //for all the terms in the glossary
name = xmlhttp.getElementsByTagName("glossary")[0].getElementsByTagName("term")[i].getElementsByTagName("name")[0].firstChild.nodeValue;
definition = xmlhttp.getElementsByTagName("glossary")[0].getElementsByTagName("term")[i].getElementsByTagName("definition")[0].firstChild.nodeValue;
if (name == '<%=nameOfTerm%>') { //if the name of the term passed into the glossary function matches a name in the glossary xml file
document.write ("<a href='#' class='tooltip'><%=nameOfTerm%><span>" + definition + "</span></a>");
}
}
</script>
|