Javascript jQuery使用循环生成动态表

Javascript jQuery使用循环生成动态表,javascript,jquery,Javascript,Jquery,我做错了什么: var htmlString ="\ <table width='97%' height='233px' border='1' class='NewTable'>\ <tr>\ <th width='43%'>"+currGroupAry[j]+"</th>\ &

我做错了什么:

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>"
var htmlString=”\
\
\
“+当前组[j]+”\
要点\
理由\
\
\
愿意经常分享想法和资源\
\
\
\

“对于(var i=0;i这是我将如何做的……考虑到您当前的代码……但再次强调……这并不是我将如何做的

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>";
var htmlString=”“+currengroupary[j]+“PointsJustification愿意经常分享想法和资源”;

对于(var i=0;为了提供有用的信息,我们需要有关您的问题的完整详细信息。您预计会发生什么,现在正在发生什么,以及您尝试解决它的方法是什么?请包括错误消息和/或意外行为的描述。在htmlString和寻找合适的syntex之间有一个for循环,以便在t中放置for循环jQuery的变量。有一个主表,其中一个我需要另一个表。你不能在javascript stringKyleK中插入javascript循环。这正是我想要的。我将它改为j。但是在这一行下出现了一些错误“user is not defined”:htmlString+=“”刚刚解决了它。谢谢KyleK的解决方案。你这个笨蛋!