2009年7月14日 星期二

色碼表

暑假無聊來寫一些簡單的小程式

這是用javascript來產生色碼表的程式
靈感是來自於以前高中老師所Show的範例

因為怕會消耗太多運算資源,所以Decimal換成Hex Code直接用Array來轉換


<script language="JavaScript">
<!--
var hex = new Array(16)

var i
var j
var k

hex[0] = "00"
hex[1] = "11"
hex[2] = "22"
hex[3] = "33"
hex[4] = "44"
hex[5] = "55"
hex[6] = "66"
hex[7] = "77"
hex[8] = "88"
hex[9] = "99"
hex[10] = "AA"
hex[11] = "BB"
hex[12] = "CC"
hex[13] = "DD"
hex[14] = "EE"
hex[15] = "FF"

document.write('<table border="0">')
document.write('<tr>')
for(i=0;i<16;++i)
{
 document.write('<td>')
 document.write('<table border="0">')
 for(j=0;j<16;++j)
 {
  document.write('<tr>')
  for(k=0;k<16;++k)
  {
  document.write('<td bgcolor="#' + hex[i] + hex[j] + hex[k] + '" width="15" height="15"></td>')
  }
  document.write('</tr>')
  }
  document.write('</table>')
  document.write('</td>')
 
  if(i%4==3)
  {
  document.write('</tr><tr>')
  }
}
document.write('</tr>')
document.write('</table>')

// -->
</script>



結果大概長這樣


怎麼越看越像Die上面的Cache field @@"

按繼續閱讀後有圖有真相






圖是來自Intel發表的45nm新製程Penryn的簡報

沒有留言:

張貼留言

Related Posts Plugin for WordPress, Blogger...