實作的原理 : 利用 "00","33","66","99","CC","FF"來組合顏色,是不是很easy啊!!!
protected void Page_Load(object sender, EventArgs e) { string html = ""; int no = 0; foreach (var c1 in new string[] { "FF", "CC", "99", "66", "33", "00" }) { foreach (var c2 in new string[] { "FF", "CC", "99", "66", "33", "00" }) { foreach (var c3 in new string[] { "FF", "CC", "99", "66", "33", "00" }) { html += ("<DIV style='height:20px;width:300px;background-color:#" + c1 + c2 + c3 + "'>" + no + " " + c1 + c2 + c3 + "<DIV>"); no++; } } } divShow.InnerHtml = html; }
沒有留言:
張貼留言