2 回答
TA贡献1831条经验 获得超10个赞
我能够通过以下代码解决此问题。
/*User Selection Of Indicators*/
var numInd = 3 /*This is amount of indicators that should show in innerHTML.*/
/*User Entry Variables Per Selection*/
var uHeight = 120
var uWidth = 225
/*Html Variables*/
var divStart = '<div class="col-sm-auto">'
var userEntryVars = '<img src="whatever.jpg" style="height:' + uHeight +'px; width: '+ uWidth + 'px">'
var divEnd = '</div>'
/*Div InnerHTML*/
var divArea = document.getElementById("IndicatorArea") ;
var out = []
var indVars = divStart + userEntryVars + divEnd ;
/*Loop For Number Of Indicators*/
for (i = 0; i < numInd; i++){
out.push(indVars)
};
divArea.InnerHTML = out.join("")
TA贡献1936条经验 获得超6个赞
因为indVars
,现在你正在加在一起divStart + userEntryVars + divEnd
。
如果你想要indVars[0] = divStart
and indVars[1] = userEntryVars
,像这样声明它
var indVars = [divStart, userEntryVars, divEnd]
添加回答
举报