js 拼接 三列做为一行

function Ajax_GetCourseAndResource(data) {
    $(".ol-course-list").empty();
    var html = "";
    var len = data.Data.length;
    for (var i = 0; i < len; i++) {
        var len2 = data.Data[i].Resourceses.length;
        html += ' <div class="ol-course-list">' +
                '<h2>' + data.Data[i].Title + '</h2>' +
                ' <table class="ol-table"><tbody>';
        for (var j = 0; j < len2; j++) {
            if ((j % 3) == 0) {
                html += '<tr>' +
                    '<td><span><a href="' + data.Data[i].Resourceses[j].FilePath + '">' +
                    data.Data[i].Resourceses[j].Name + '</a></span></td>';
            } else {
                html += '<td><span><a href="' + data.Data[i].Resourceses[j].FilePath + '">' +
                    data.Data[i].Resourceses[j].Name + '</a></span></td>';
            }
        }
    }
    $(".ol-course-list").append(html);
}

posted @ 2014-01-17 16:28  Seaurl  阅读(638)  评论(0编辑  收藏  举报