我正在尝试为多个 ID 创建条形图/进度条。但由于某种原因,我被难住了。
var bar = document.getElementById("chart1", "chart2", "chart3");
var progress = document.getElementById("progress1", "progress2", "progress3").innerHTML;
function setProgress(percent){
bar.style.width = percent + "%";
if (percent > 70)
bar.className = "graph graph-green";
else if (percent > 40)
bar.className = "graph graph-yellow";
else if (percent > 0)
bar.className = "graph graph-red";
}
var interval = setInterval(
function(){
setProgress(progress);
}, 100);
任何帮助都是极好的。