2

我的代码是这个

var call_from='fb_test'
jQuery('.test').html("<img src=\"https://wwww.socialappshq.com/images/socialapps/loading.gif\" height=\"15\" width=\"15\" id=\"loading_image_\" + call_from + \">");

但是它,没有正确连接请帮助我

4

4 回答 4

2

当您使用 javascript 编写 html 时,更喜欢'将字符串和"属性值括起来

var call_from='fb_test'
jQuery('.test').html('<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '">');
于 2013-07-31T04:41:31.157 回答
1

试试下面的代码。

var call_from='fb_test';
var yourHtml = '<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '"/>';
jQuery('.test').html(yourHtml);
于 2013-07-31T04:42:37.617 回答
1

对于连接JavaScript 试试这个

  var call_from='fb_test'
  jQuery('.test').html("<img src=\"https://wwww.socialappshq.com/images/socialapps/loading.gif\" height=\"15\" width=\"15\" id=\"loading_image_\"" + call_from + "\">");
于 2013-07-31T04:42:42.047 回答
0
var yourHtml = '<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '"/>';
            jQuery('.'+call_from).html(yourHtml);
于 2013-07-31T04:59:43.103 回答