这是我的代码:
var realThing = defined here;
someHtml += "<img src='{0}' id='realThing'/> </a>".replace("{0}", something.something);
如何将realThing,变量放在someHtml中,这是另一个变量?
答案 0 :(得分:1)
示例:
var Something = "words";
var SomeHTML = '<a href="/directory/' + Something + '/">Link</a>';
您必须将SomeHTML变量中的文本与+符号分开才能将其连接起来。
答案 1 :(得分:0)
var realThing = defined here;
someHtml += "<img src='{0}' id='" + realThing + "'/> </a>".replace("{0}", something.something)