我嘗試使用HTML color
變量改變listview
背景色HTML,但其沒有工作,但是當我分配簡單background-color:red;
那麼它的工作,但我想改變使用color
顏色變量。改變他的ListView的背景顏色採用可變
<ul>
<script>
var d = new Date();
var d = new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
var color="red";
var day=d.getDay();
for(var i=0;i<7;i++)
{
if(day==7)
day=0;
document.write("<li style='background-color:'"+color+"';'>");
document.write(weekday[day]); document.write("</li>");
day++;
}
</script>
</ul>
}
</script>
</ul>
</body>
</html>
thanx its working – user3245211