Hi,
I'm currently working on my portfolio website and would like to have information about my movie clips be retrieved from an XML document when a thumbnail is clicked. I am building my website in HTML and would like to retrieve the Xml using JavaScript. Any help would be appreciated.
My XML is valid and structured as such:
<?xml version="1.0" encoding="UTF-8"?>
<work>
<motion>
<reel>
<title id="Demo Reel 2009" project="Self Promotion" client="Self">
<![CDATA[This demo reel is primaraly a collection ......]]>
</title>
</reel>
.
.
.
.
These are my initial variable definitions and readXML function in javascript:
<script language="javascript">
var xmldom, workNode, motionNode, printNode, fineartNode, displayNode, titleNode;
[B]function readXMLDocument()[/B]
{
[B]xmldom=createDocument();
xmldom.async=false;[/B]
if (xmldom.parseError != 0) {
alert("An error occurred: \nError Code " + xmldom.parseError.errorCode + "\n" + "Line: " + xmldom.parseError.line + "\n" + "Line Pos: " + xmldom.parseError.linepos + "\n" + "Reason: " + xmldom.parseError.reason);
} else {
alert("Document: " + xmldom.documentElement);
alert("Root: " + xmldom.documentElement.tagName);
alert("Child: " + xmldom.documentElement.firstChild.tagName);
alert("Xml DOM: " + xmldom.xml);
}
[B]xmldom.load("workinfo.xml");[/B]
[B]workNode=xmldom.documentElement;
motionNode=workNode.firstChild;
printNode=motionNode.nextSibling;
fineartNode=printNode.nextSibling;[/B]
}
.
.
.
.
A call to function revealText is called "onClick" of a thumbnail as such:
<a href="videopages/reel.html" class="vid" target="video" onClick="revealText(0)">
This is function revealText:
[B]function revealText(x)[/B]
{
var title, project, client, info;
[B]
readXMLDocument();[/B]
[B]displayNode=motionNode.childNode[x];[/B]
[B]titleNode=displayNode.firstChild;[/B]
[B]title=titleNode.getAttribute("id");
project=titleNode.getAttribute("project");
client=titleNode.getAttribute("client");
info=titleNode.getNodeValue();[/B]
[B]titleSpan.innerHTML=title;
projectSpan.innerHTML=project;
clientSpan.innerHTML=client;
infoSpan.innerHTML=info;[/B]
}
</script>
and these are the spans they are written to:
<span id="titleSpan" class="vidinfo">
<span id="projectSpan" class="vidinfo">
<span id="clientSpan" class="vidinfo">
<p id="infoSpan" class="content">
If you have read this far, I REALLLLY appreciate it. And any ideas as to what is wrong would help alot.