国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

鼠標(biāo)選擇動(dòng)態(tài)改變網(wǎng)頁(yè)背景顏色的JS代碼

2019-11-20 21:29:42
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

采用Javascript實(shí)現(xiàn),用鼠標(biāo)點(diǎn)擊相應(yīng)顏色,動(dòng)態(tài)改變網(wǎng)頁(yè)背景顏色

這是截圖

相應(yīng)的Javascript源代碼為:

復(fù)制代碼 代碼如下:

var hex = new Array(6)

hex[0] = "FF"
hex[1] = "CC"
hex[2] = "99"
hex[3] = "66"
hex[4] = "33"
hex[5] = "00"
function display(triplet) {
document.bgColor = '#' + triplet
}
function drawCell(red, green, blue) {
document.write('<TD BGCOLOR="#' + red + green + blue + '">')
document.write('<A HREF="javascript:display(/'' + (red + green + blue) + '/')">')
document.write('<IMG SRC="place.gif" BORDER=0 HEIGHT=12 WIDTH=12>')
document.write('</A>')
document.write('</TD>')
}
function drawRow(red, blue) {
document.write('<TR>')
for (var i = 0; i < 6; ++i) {
drawCell(red, hex[i], blue)
}
document.write('</TR>')
}
function drawTable(blue) {
document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')
for (var i = 0; i < 6; ++i) {
drawRow(hex[i], blue)
}
document.write('</TABLE>') 
}
function drawCube() {
document.write('<TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1><TR>')
for (var i = 0; i < 6; ++i) {
document.write('<TD BGCOLOR="#FFFFFF">')
drawTable(hex[i])
document.write('</TD>')
}
document.write('</TR></TABLE>')
}
drawCube()

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 华池县| 大新县| 托里县| 莆田市| 玛多县| 当涂县| 盐山县| 河池市| 永春县| 区。| 左权县| 年辖:市辖区| 绩溪县| 高邑县| 岳西县| 呼图壁县| 金华市| 淮南市| 南充市| 上虞市| 津市市| 县级市| 潼南县| 交口县| 松潘县| 双鸭山市| 读书| 黎川县| 新邵县| 南澳县| 汽车| 庆城县| 西畴县| 枣强县| 古田县| 沭阳县| 织金县| 弥渡县| 阜阳市| 淅川县| 山阴县|