The Pretext:
I am building an HTA for a proposal. I have to load an external XML document into a table, dynamically. Also, while loading the table, I have to create links for a certain column, making the whole TD the link, rather than the text. All of that is already completed.
The Problem:
Using this code to build the individual TDs contained, and to make the one column I need as links, they all link to the same thing [at the moment].
Code:
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x[i].childNodes.length;j++)
{
if (x[i].childNodes[j].nodeType != 1) continue;
var container = document.createElement('TD');
if(j != 2)
{
var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
container.appendChild(theData);
row.appendChild(container);
}
else
{
createDoc.getElementsByTagName('launchURL');
container.setAttribute('className','clickable');
container.onclick = function () {element_onClick()};
var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
container.appendChild(theData);
row.appendChild(container);
}
}
tmp.appendChild(row);
}
When calling the function in this line
Code:
container.onclick = function () {element_onClick()};
it goes to the function
Code:
function element_onClick()
{
location.href = 'navigation.html';
}
where everything is linked to the same navigation.html [for testing purposes].
My problem is exactly this: I cannot find anyway to dynamically take the text of each individual launchURL tag from the XML, append it to the properly linked folder definition that is also dynamically created, so that it loads that course. And I cannot hard-code it because this problem has to be solved in such a way that the code can be both extensible and usable by many customers, all of whom's file systems are not designed in the same way.
I hope somebody understands what I want to do and can help me with a solution.