AciDWarrioR, запустить код, подождать 3 секунды, долго думать.
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
td{
width: 50px;
border: 1px solid #000000;
text-align: center;
height: 50px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(function() {
var mytable = $("<table/>");
$.each(Array(10), function(i, myData) {
$(mytable).append($("<tr/>").append($.map(Array(10), function(a, num) {
return $("<td/>", {
text: num
})
})))
});
$("body").append(mytable);
function fn(data, table) {
var del = [];
Object.keys(data).forEach(function(key) {
var tr = $("tr", table).eq(key);
Object.keys(data[key]).forEach(function(i) {
var td = $("td", tr).eq(i);
var len = data[key][i];
td[0].colSpan = len;
var temp = td.next();
for (var k = 1; k < len; k++) {
temp.length && del.push(temp);
temp = temp.next()
}
})
});
$.each(del, function(i, td) {
td.remove()
})
}
var data = {
0: {
0: 2,
5: 2
},
1: {
0: 2,
5: 2
}
};
window.setTimeout(function() {
fn(data, mytable)
}, 3E3)
});
</script>
</head>
<body>
</body>
</html>