0

您好,我正在尝试将表添加到 div 但萤火虫给了我这个错误: SyntaxError: unterminated string literal [Break On This Error] $('#news-tweets').append('

这是正在运行的代码:

            for (var i in array) {
                var location = array[i].location;
                var user = array[i].user;
                var date = array[i].date;
                var profile_img = array[i].profile_img;
                var text = array[i].text;
                var url = array[i].url;
                show_tweets(user,date,profile_img,text,url);
                geocode(user, date, profile_img, text, url, location);
            }
            function show_tweets(user, date, profile_img, text, contentString){
                $('#news-tweets').append('<table width="320" border="1">
                <tr>
                  <td colspan="2" rowspan="1">"+user+"</td>
                </tr>
                <tr>
                  <td width="118">"+profile_img+"</td>
                  <td width="186">"+text+"</td>
                </tr>
              </table>');
                }

它告诉我我之前有一个错误

4

1 回答 1

2

尝试

function show_tweets(user, date, profile_img, text, contentString)
{
    $('#news-tweets').append('<table width="320" border="1"><tr><td colspan="2" rowspan="1">' + user + '</td></tr><tr><td width="118">' + profile_img + '</td><td width="186">' + text + '</td></tr></table>');
}
于 2012-08-31T15:57:48.923 回答