-3

このテーブルを Div に追加しようとしています。しかし、動作しません。途中の For ループに問題があります。私がここで間違っていること:

    var htmlString ="\
                    <table width='97%' height='233px' border='1' class='NewTable'>\
                          <tr>\
                            <th width='43%'>"+currGroupAry[j]+"</th>\
                            <th width='8%'>Points</th>\
                            <th width='49%'>Justification</th>\
                          </tr>\
                          <tr>\
                            <td height='29'>Was willing to frequently share ideas and resources</td>\
                            <td><input id='TotalTEP1' type='text' value='' readonly /></td>\
                            <td>\
                                <table id='gp1' width='100%'>\
                                "for(var i=0; i<=currGroupAry.length; i++){"\
                                    <tr><td style='width:100px;'>"+currGroupAry[j]+"</td><td><textarea style='width:97%; font-size: 14px; background-color: transparent; border:none; resize:none;' cols='10' rows='2' readonly>"+user.comments[j-1]+"</textarea></td></tr>"}"\
                                </table>\
                            </td>\
                          </tr>\</table>"

このテーブルを Div に追加しようとしています。しかし、動作しません。途中の For ループに問題があります。

4

1 に答える 1

2

これは私がそれを行う方法です...あなたの現在のコードを考えると....しかし、もう一度....それは私がそれを行う方法ではありません.....

var htmlString ="<table width='97%' height='233px' border='1' class='NewTable'><tr><th width='43%'>"+currGroupAry[j]+"</th><th width='8%'>Points</th><th width='49%'>Justification</th></tr><tr><td height='29'>Was willing to frequently share ideas and resources</td><td><input id='TotalTEP1' type='text' value='' readonly /></td><td><table id='gp1' width='100%'>";

for(var i=0; i<=currGroupAry.length; i++){
htmlString+="<tr><td style='width:100px;'>"+currGroupAry[i]+"</td><td><textarea style='width:97%; font-size: 14px; background-color: transparent; border:none; resize:none;' cols='10' rows='2' readonly>"+user.comments[i-1]+"</textarea></td></tr>";
 }

htmlString+="</table></td></tr></table>";

また....ループ内でまたはが必要かどうかはわかりませんが、currGroupAry[j]ループに関連情報を表示することを想定して変更しましたが、それが必要な場合に戻ります。currGroupAry[i]jij

于 2013-06-28T16:31:21.120 に答える