首 页免费资源建站技术源码下载软件下载精品淘吧客户留言
用户登陆 | 用户注册
您当前的位置:笃志小屋建站技术特效代码页面背景 → 文章内容
背景调色板
作者:佚名  来源:不详  发布时间:2007-9-29 22:46:18

2007-9-29 22:46:18免费资源duzhi.net

背景调色板


<!-- 网页特效代码由duzhi . net提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<script language="Javascript">
<!--

// create 6-element array
var hex = new Array(6)

// assign non-dithered descriptors
hex[0] = "FF"
hex[1] = "CC"
hex[2] = "99"
hex[3] = "66"
hex[4] = "33"
hex[5] = "00"

// accept triplet string and display as background color
function display(triplet) {
// set color as background color
document.bgColor = '#' + triplet

// display the color hexadecimal triplet
alert('现在的背景色是 #'+triplet)
}

// draw a single table cell based on all descriptors
function drawCell(red, green, blue) {
// open cell with specified hexadecimal triplet background color
document.write('<TD BGCOLOR="#' + red + green + blue + '">')

// open a hypertext link with javascript: scheme to call display function
document.write('<A HREF="javascript:display('' + (red + green + blue) + '')">')

// print transparent image (use any height and width)
document.write('<IMG SRC=http://www.webasp.net/javascript/1/"place.gif" BORDER=0 HEIGHT=12 WIDTH=12>')

// close link tag
document.write('</A>')

// close table cell
document.write('</TD>')
}

// draw table row based on red and blue descriptors
function drawRow(red, blue) {
// open table row
document.write('<TR>')

// loop through all non-dithered color descripters as green hex
for (var i = 0; i < 6; ++i) {
drawCell(red, hex[i], blue)
}

// close current table row
document.write('</TR>')
}

// draw table for one of six color cube panels
function drawTable(blue) {
// open table (one of six cube panels)
document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')

// loop through all non-dithered color descripters as red hex
for (var i = 0; i < 6; ++i) {
drawRow(hex[i], blue)
}

// close current table
document.write('</TABLE>')
}

// draw all cube panels inside table cells
function drawCube() {
// open table
document.write('<TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1><TR>')

// loop through all non-dithered color descripters as blue hex
for (var i = 0; i < 6; ++i) {
// open table cell with white background color
document.write('<TD BGCOLOR="#FFFFFF">')

// call function to create cube panel with hex[i] blue hex
drawTable(hex[i])

// close current table cell
document.write('</TD>')
}

// close table row and table
document.write('</TR></TABLE>')
}

// call function to begin execution
drawCube()

// -->
</script>

 
[ ] [返回上一页] [打 印]

【笃志小屋duzhi.net】

  技术文章导航
  技术文章排行
  精彩推荐
Copyright www.duzhi.net All Right Reserved.
设计制作:翼迅设计室 Equick Desgin Home 在线QQ:303471038
网络备案号:冀ICP备06008201号 站长信箱:webmaster#duzhi.net(将#换为@)
本站部分文章和图片来源于网络和内容提供伙伴,如果侵犯了您的权利,请留言告知,本站定会及时删除相关文件!