高分~~~急求 一简单javascript调色板

来源:百度知道 编辑:UC知道 时间:2024/05/10 19:33:57
希望高手能帮忙做一个 简单点大概就3x3个小格子的调色板,就那种点一下小格子中的颜色,背景就变成那种颜色的,希望颜色普遍一点
代码简单点,看起来像新手做的……
不胜感激阿~~~~~~~~~~~~~~~~~~
是3x3小格子,每个格子里边有不一样的颜色

<html>
<style>
span{position:absolute; width:20; height:20;}
#sp1{left:20;top:15;}
#sp2{left:40;top:15;}
#sp3{left:60;top:15;}
#sp4{left:20;top:35;}
#sp5{left:40;top:35;}
#sp6{left:60;top:35;}
#sp7{left:20;top:55;}
#sp8{left:40;top:55;}
#sp9{left:60;top:55;}

</style>
<script>
function changebg(x){
var sColor=document.all.item(x.id).style.backgroundColor;
document.body.style.backgroundColor=sColor;
}

</script>
<body bgcolor=ffcc66>
<span id=sp1 style="background-color:ff0000;" onclick=changebg(this)></span>
<span id=sp2 style="background-color:008800;" onclick=changebg(this)></span>
<span id=sp3 style="background-color:00ff00;" onclick=changebg(this)></span>
<span id=sp4 style="background-color:ccffcc;" onclick=changebg(this)&g