Wrox Programmer Forums
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2006, 02:46 PM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Linking in XML

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic XML Scripts IrishJoker XSLT 2 August 30th, 2006 05:33 AM
Crystal Reports with dynamic XML kncd2005 Crystal Reports 0 May 27th, 2005 12:11 PM
Dynamic XML site NeilS21 XML 1 April 18th, 2005 07:35 PM
Linking opml/xml files to a html page helensobrien XML 0 February 21st, 2005 01:48 PM
Dynamic Email --> XML MadMaxMan XML 2 June 4th, 2003 04:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.