Part of your problem is that you have duplicated ID values.
ID values must be unique. Otherwise getElementById() gets very confused.
Also your onclick function calls a loop that looks at each cell of the table.
Why?
What is it exactly that you want to alert? Just the Company name or something else?
If it is just the ID then this should work...
Code:
onclick="alert(this.id)"
or use "alert(this.value)" if you don't really mean to "displayID"