***页面背景***鼠标指向颜色块,在状态栏就能看到该颜色的代码
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果把如下代码加入到<body>区域中
<script language="javascript">
<!--
var hex = new array(6)
hex = "ff"
hex = "cc"
hex = "99"
hex = "66"
hex = "33"
hex = "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="place.gif" border=0 height=12 width=12>')
// close link tag
document.write('http://code.ik8.com/html/place.gif</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, 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, 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 blue hex
drawtable(hex)
// close current table cell
document.write('</td>')
}
// close table row and table
document.write('</tr></table>')
}
// call function to begin execution
drawcube()
// -->
</script>
--------------------------------------
拥有三人行论坛管理系列软件,一个人就可以管理一个论坛的更新维护。还能使您的论坛有千人在线的真实火暴效果,让您不在为论坛因没有人气而留不住会员而烦恼,使您的论坛早日成为一流的论坛。详情请登陆网站:http://www.cnsrx.cn 三人行论坛管理软件,站长必备的专业好工具。(您使用的是免费版本,购买收费版本后,将不带广告。业务QQ:247216 44985227)
页:
[1]