HTML table - value attribute

Associate
Joined
26 Nov 2004
Posts
1,480
Location
Gran Canaria
Hi

I'm really new to all this but is there a way to store a value to a table cell, within the tag say, similar to a select box> I'm looking for a default value to be stored in each cell of a row which I will access via DOM and use to update the value of the cell itself.
 
So far I've got :

Code:
		var tables = Core.getElementsByClass("nuTable");
	    for (var j = 0; j < tables.length; j++)
	    {
			var rows = tables[j].getElementsByTagName("tr");
			for (var k = 0; k < rows.length; k ++)
			{
				var cells = rows[k].getElementsByTagName("td");
				for (var l = 0; l < cells.length; l++  )
				{
					if ( l == 1 ) 
					{
					//alert(cells[l].);
						//cells[l].innerHTML = cells[l].value * document.getElementById("preMulti").value * document.getElementById("preSizes").value;
					}
				}
			}
		}

Really the problem I have is that once the cell is updated, the original value is lost. Is there an easier way to store persistent data in javascript? I haven't been able to find anything.

Thanks for your help. :)
 
Each cell contains a numeric value which I need to multiply by another numeric value which is stored in a text box and updated on keyup. I need the original value to be stored somewhere so it can be used in each separate multiplication.
 
Not worried about non-javascript really, no.

So I need to add a span element, where it hasn't previously been added, encompassing each cell of this column?
 
Back
Top Bottom