0

(the points object can not be changed)

How to create?: table with 30 rows and 30 cols; all cells have blue background; all cells that exist in points object with coordinates (x=cols, y=rows) to have red background.

For example: cell on row 15 and col 12 must be with red background. cell on row 18 and col 12 must be with red background. cell on row 21 and col 12 must be with red background. and so on.

var Points = {
    "points" : [
        { "id": "F2", "x": "12", "y": "15" },
        { "id": "F3", "x": "12", "y": "18" },
        { "id": "F4", "x": "12", "y": "21" },
        { "id": "F5", "x": "12", "y": "25" },
        { "id": "F6", "x": "12", "y": "27" },
        { "id": "F7", "x": "12", "y": "29" },
        { "id": "C1", "x": "30", "y": "12" },
        { "id": "C2", "x": "30", "y": "15" },
        { "id": "C3", "x": "30", "y": "18" },
        { "id": "C4", "x": "30", "y": "25" },
        { "id": "C5", "x": "30", "y": "27" },
        { "id": "C6", "x": "30", "y": "29" }
    ]
}
4

1 回答 1

0

您需要做的是“遍历”点数组中的所有元素,然后使用eq()jquery 来完成您的工作。请记住,在 html 中<tr>表示行(行)并且<td>是列。你可以检查这个小提琴中的东西

于 2013-06-13T16:18:17.257 回答