我想发送一个sting从处理js到javascript的颜色在css中使用。格式如下:"rgb(255,0,0)"(或任何颜色值)。
无论我尝试什么,我得到这个错误:
Uncaught TypeError: number is not a function
我做了几次测试,它总是红色的(....这是导致错误的原因(可能是绿色和蓝色)。
String getRowColor(int r) {
if (r > rows || r < 0) {
return null;
}
else {
color c= colors[r];
String cStr = "rgb(";
cStr += red(c)+", ";
cStr += green(c)+", ";
cStr += blue(c)+")";
return cStr;
}
}
我认为:
color c= colors[r];
应该是:color c= color(r);