替换tr&在javascript文件中使用div的td

时间:2017-01-04 10:13:03

标签: jquery-ui

    var URI = OMSiteUrl + GetLevelZeroDisplay;
    $.ajax({
        type: "GET",
        url: URI, //URI
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (Json) {
            var r = new Array(), i = -1;
            var tr = '';
            tr = tr + '<tr>';
            if (Json != null) {

                var i;
                var len = Json.length;

                for (i = 0; i < len; i++) {
                    if (Json[i].Publish == true || isadmin == True) {
                        if (isadmin == True) {
                            debugger;
                            tr = tr + '<td>'
                            tr = tr + '<table><tr><td>'
                            tr = tr + '<div id="theDiv" class="DivClass" style="text-align:center;">';
                            tr = tr + ' <div style="margin-right:16%;float:right;"> <img  id="btnAddNewLevelOne" src="../Images/add-icon.png" alt="ADD" onclick="BindSequencingLevelOne(' + Json[i].ID + ')" style="height: 12px; margin-right: 4px; margin-top: -5px;"></div>';
                            tr = tr + '<img  id="btnEdit" onclick="EditLevelZeroValue(' + Json[i].ID + ')" src="../Images/Edit-icon.png" title="Edit" alt="Smiley face" style="float:left;margin-left:11%;">';
                            tr = tr + " <label id='LevelLbl' class='wrap' style='height:20px;margin:19px 0 0 0px;z-index:2;top: 20px; color:white;max-width:68%;min-height:41px;white-space:initial;word-wrap: break-word;text-align:center;display: inline-block;vertical-align:middle; font-weight: 400; font-size: 14px; font-family: Segoe UI, Segoe, Tahoma, Helvetica, Arial, sans-serif;'> " + Json[i].Title + " </label>";
                            tr = tr + '<div><img  id="btnDelete" onclick="DeleteLevels(' + Json[i].ID + ')" src="../Images/delete-White.png" title="Delete"   alt="Smiley face" style="margin:-3px 0 0 19px;float: left;"></div>';
                            tr = tr + " </div> ";
                            tr = tr + " </td> ";
                            tr = tr + "</tr>";
                        }

嗨,这是执行ajax调用获取关卡的代码。我想要在哪里使用tr&amp; td或table它应该被div替换。在这段代码中我们使用tr&amp; td,以便数据应该在每一行..这个代码工作正常,但现在我想用div替换它。

请帮我解决这个问题

提前致谢

0 个答案:

没有答案