b1

by dirkk0

HTML

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css">
<div id="a"> </div>
<div id="content"> </div>

CSS

.span1{ background: #cdcdcd; }
.span2{ background: #cdaacd; }
.span3{ background: #cdcdaa; }
.span4{ background: #aacdaa; }
.span6{ background: #aacdcd; }
.span12{ background: #cdaacd; }

JavaScript

var t1 = "test";


function doit(v) {
    if (v == 1) {
        lines = ["12 ",
                                     "6 6 0",
                                     "3 6 3",
                                     "3 6 3"
                                    ];
    }
    else {
        lines = ["6 3 3",
                                     "3 6 3",
                                     "4 4 4",
                                     "6 6"
                                    ];
    }

    $('#content').empty();

    for (var r = 0, l = lines.length; r < l; ++r) {
        blocks = lines[r].split(" ");
        $('<div/>', {
            "id": "r" + r,
            "class": "row"
        }).appendTo('#content')

        for (var i = 0, l = blocks.length; i < l; ++i) {

            $('<div/>', {
                "class": "span" + blocks[i],
                html: blocks[i] + "<br><br><br>",

            }).appendTo('#r' + r)

        }
    }
}

doit(1);