- HTML code
<div class="dashboard-sign"></div>
- JScript code
var rootDom=$(".dashboard-sign"); for(var i=0; i<$(dashboard_statusitems).length;i++) { var dashboard_statusitem = dashboard_statusitems[i]; var status = $(dashboard_statusitem).html(); var img01 = document.createElement("img"); if(status=="ok"){ img01.setAttribute("src", "images/circle_ok_16.png"); rootDom.appendChild(img01); } else if(status=="SEND WAITING"){ img01.setAttribute("src", "images/circle_SEND WAITING_16.png"); rootDom.appendChild(img01); } else{ `````````````````` } }
------解决方案--------------------
试试:
var rootDom=$(".dashboard-sign");
for(var i=0; i<$(dashboard_statusitems).length;i++) {
var dashboard_statusitem = dashboard_statusitems[i];
var status = $(dashboard_statusitem).html();
var img01 = document.createElement("img");
if(status=="ok"){ img01.src="images/circle_ok_16.png"; }
else if(status=="SEND WAITING"){ img01.src="images/circle_SEND WAITING_16.png"; }
else{ }
rootDom.appendChild(img01);
}