How to put data in the right place of a table?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to put data in the right place of a table?

934 次查看
winmaxi
Contributor I

I have constructed a table, and I have a bunch of data to send to the webpage. How do I define where I want to put each data in each cell of the table.

for example.
Here are two commands in my parse_val function.
I got the value from a C file, and parse it.
The next command tells where to put the value; it is after "Mode:".
__________________________________________________ ___
hvac_value[0] = parsed[0];
mode.innerHTML = "<h1>Mode: "+hvac_value[0]+"</h1>";
__________________________________________________ ___

But now I have a table.
It is written in this way:
<th scope="row"><p>Results </p>
</th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
.......
In each row, there are a bunch of cells. I want to put different values in each of the empty data.
As there is nothing in each cell now; and each cell have <td></td> in front and behind.
I don't know how I can define where I want to put each data.


Is there anyone can help me with this?

标签 (1)
标记 (1)
0 项奖励
回复
1 回复

629 次查看
JonSmith
Contributor II

Hi,

 

May be you can use this way:

<th scope="row"><p>Results </p></th><td><div id="result_1"> </div></td><td><div id="result_2"> </div></td><td><div id="result_3"> </div></td>

 

and then in your parse_val function:
 
result_1.innerHTML  = parsed[0];result_2.innerHTML  = parsed[1];result_3.innerHTML  = parsed[2];

 

Regards!

 

0 项奖励
回复