1.icwh - pr -prjj02a.jsp
这里改变的是 ★ ,字体的颜色,实现代码为:
<font color="green" id="G43">★</font>
js代码:
document.getElementById("G"+j+""+i+"").color="yellow";(j、i是做循环用)
2.yxtg - pod - wsjjA05main.jsp
这里改变的是一整个td框的颜色,实现代码为:
<%
String statusColor="";
if(ws01VOShow.getStatus().equals("D")){
statusColor="bgcolor='red' style='color:white'";
}
if(ws01VOShow.getStatus().equals("C")){
statusColor="bgcolor='blue' style='color:white'";
}
if(ws01VOShow.getStatus().equals("B")){
statusColor="bgcolor='green' style='color:white'";
}
if(ws01VOShow.getStatus().equals("R")){
statusColor="bgcolor='red' style='color:white'";
}
if(ws04VOShow.getPlanPdiDate().equals("")){
statusColor="bgcolor='yellow'";
status = "" ;
}
%>
页面代码为:
<td width="5%" <%=statusColor%>><%=status%></td>
注意这里,<%=statusColor%>是写在<td>里面的。
3.由16进制颜色代码向RGB代码转换。
public class color {
public static void main(String[] args) {
String r, g, b;
Random random = new Random();
//random.nextInt(256) 随机产生一个0到256的随机数,不含256
r = Integer.toHexString(random.nextInt(256)).toUpperCase();
g = Integer.toHexString(random.nextInt(256)).toUpperCase();
b = Integer.toHexString(random.nextInt(256)).toUpperCase();
r = r.length() == 1 ? "0" + r : r;
g = g.length() == 1 ? "0" + g : g;
b = b.length() == 1 ? "0" + b : b;
System.out.println("#" + r + g + b);
}
}
绿豆沙颜色:色调80,饱和度97,亮度205