我有一张桌子。 HTML
<div class="row-fluid">
<table class="table table-striped" id="table-visual-features">
<thead>
<tr>
<th>Visual Feature</th>
<th>Type [currently not used]</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr><td>A11</td><td>Numeric [1..30]</td><td>Values to be mapped to the S1-axis</td><td><button class="action-change">edit</button> <button class="btn btn-mini btn-danger action-remove-visual-feature">remove</button></td></tr>
<tr><td>A21</td><td>Numeric [1..10 ]</td><td>Values to be mapped to the S2-axis</td><td><button class="action-change">edit</button> <button class="btn btn-mini btn-danger action-remove-visual-feature">remove</button></td></tr>
<tr><td>A31</td><td>Numeric [1..20 ]</td><td>Values to be mapped to the S3-axis</td><td><button class="action-change">edit</button> <button class="btn btn-mini btn-danger action-remove-visual-feature">remove</button></td></tr>
</tbody>
</table>
</div>
我想将我的值从表转换为这种形式
var features = {
features: {
"A11": {"type_feature": "Numeric [1..30]", "description_feature": "Values to be mapped to the S1-axis"},
"A21": {"type_feature": "Numeric [1..10]", "description_feature": "Values to be mapped to the S2-axis"},
"A31": {"type_feature": "Numeric [1..20]", "description_feature": "Values to be mapped to the S3-axis"}
}
};
我取行中第一个单元格的值,它是“A11”。行中第二个单元格的值为“Numeric [1..30]”。行中第三个单元格的值是“要映射到 S1 轴的值”。我们首先进入
features: {
"A11": {"type_feature": "Numeric [1..30]", "description_feature": "Values to be mapped to the S1-axis"}}
这是我的 jsfiddle http://jsfiddle.net/7q3KP/
请帮我转换价值。先感谢您