var tb=document.getElementById("tableID")
for(i=0;i<tb.rows.length;i++)
for(j=0;j<tb.rows[i].cells.length;j++)
tb.rows[i].cells[j].style.backgroundColor="#FF00FF"
for(i=0;i<tb.rows.length;i++)
for(j=0;j<tb.rows[i].cells.length;j++)
tb.rows[i].cells[j].style.backgroundColor="#FF00FF"
现在的问题是我只要把颜色填入鼠标点击的单元格,而其它没有被点击的单元格不填入颜色?这样他就可以任意用鼠标点击想要填充的单元格。不知道这个怎么实现?只要这个实现我马上给你加分,非常感谢!
document.onclick=c
function c(){
var e=event.srcElement
if(e.tagName=="TD")e.style.backgroundColor="#FF00FF"
}
</script>
SelRGB = event.srcElement.bgColor;
EndColor();
</SCRIPT> <script>
document.onclick=c
function c(){
var e=event.srcElement
if(e.tagName=="TD")e.style.backgroundColor=ShowColor.bgColor
}
</script><SCRIPT event=onclick for=TtTable language=JavaScript>
var tb=document.getElementById("TtTable")
for(i=0;i<tb.rows.length;i++)
for(j=0;j<tb.rows[i].cells.length;j++)
tb.rows[i].cells[j].onclick=new Function("c(this)")
</SCRIPT>