Welcome to WebmasterWorld! :)
I think offhand it sounds like tabular data so what I would probably do is assign an id to each table row...
<tr id="example_1"><td><span>item name</span></td><td><span>item value</span></td></tr>
...and then I would access the ID and the respective table data element the following way...
document.getElementById('example_1').getElementsByTagName('td')[1].getElementsByTagName('span')[0].firstChild.nodeValue = 'example text 1776';
When you script make sure that your JavaScript is
only loaded from inside the head element. A lot of people will tell you it's ok to plop it in the body element however that will quickly lead you to doing junk code that is not reliable like innerHTML or document.write in example.
Keep in mind that with
getElementsByTagName the numbering starts with 0, not 1.
If you have multiple tables you may want to adjust the row names, always make sure you use reasonably specific values for id attributes (row_1_name versus row1).
Also look closely at how each part of the code is constructed, you can section off most of the HTML and concentrate on specific parts of the page. You don't want to add tons of id attributes on every single span, that would be a waste. JavaScript when used correctly should be thought of as being dynamic. You won't make much money selling a single chicken, you'd want to sell millions of chickens. So when scripting stick that in to a function that you can call over and over again with a couple parameters and that could make it invaluable to you.
Best piece of advice, sit down, and start testing it out before asking questions, you should have more then enough to work with here and when you get really stuck post example code (not links).
Oh and one last thing a lot of people confuse the terms tag and element. In this rare example
getElementsByTagName is actually selecting the element's tag, not the element itself. However when you reference an image in example you would reference the img element. An element has two tags (except self-closing elements like images).
- John