How can I count the columns in one row?

My situation like this:

Table1
ID Col Col2 Col3… Coln

2 x null null … xxx

Now I want to count how many Columns in one row havenot null values.
For the upper table row 2, the counter should return 2 to me.

Thanks!

Here you go man just give all the TDs the same ID name.


<SCRIPT>
	var i = 0;
	function checkIt() {
	var TDlength = TDUnfold.length;
		while (i<TDlength) {
			if (TDUnfold*.innerText != "") {
			alert(i + " isn't blank");
				
			}
		i++;
		}
	}
</SCRIPT>