<script language="JavaScript"> var red = 0; var green = 0; var blue = 0; var value = 0; var convert = new Array() var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"); for (x = 0; x < 16; x++) { for (y = 0; y < 16; y++) { convert[value] = hexbase[x] + hexbase[y]; value++; } } function clear() { document.color.bl.value = blue; document.color.rd.value = red; document.color.gr.value = green; } function display() { redx = convert[red] greenx = convert[green] bluex = convert[blue] var rgb = "#" + redx + greenx + bluex; document.color.rgbdspl.value = rgb; document.bgColor = rgb; } function upred(x) { if ((red + x) <= 255) red += x document.color.rd.value = red; display() } function downred(x) { if ((red - x) >= 0) red -= x document.color.rd.value = red; display() } function upgreen(x) { if ((green + x) <= 255) green += x document.color.gr.value = green; display() } function downgreen(x) { if ((green - x) >= 0) green -= x document.color.gr.value = green; display() } function upblue(x) { if ((blue + x) <= 255) blue += x document.color.bl.value = blue; display() } function downblue(x) { if ((blue - x) >= 0) blue -= x document.color.bl.value = blue; display() } </script> <form name="color"> <table align="center"> <tr align="Center"> <td width="52"> <input name="red" type="button" value=" +50 " onclick="upred(50)"> </td> <td width="58"> <input name="red2" type="button" value=" + 10 " onclick="upred(10)"> </td> <td width="46"> <input name="red2" type="button" value=" + 1" onclick="upred(1)"> </td> <td width="52"> <font color="#FF0000" size='+3'><b><font color="#FA0000" face="楷体_GB2312">红</font></b></font> </td> <td width="46"> <input name="red-" type="button" value=" - 1" onclick="downred(1)"> </td> <td width="58"> <input name="red-" type="button" value=" - 10 " onclick="downred(10)"> </td> <td width="52"> <input name="red-" type="button" value=" -50 " onclick="downred(50)"> </td> <td width="29"> <input type="text" name="rd" size='3'> </td> </tr> <tr align="Center"> </table> <td width="52"> <input name="green" type="button" value=" +50 " onclick="upgreen(50)"> </td> <td width="58"> <input name="green" type="button" value=" + 10 " onclick="upgreen(10)"> </td> <td width="46"> <input name="green" type="button" value=" + 1" onclick="upgreen(1)"> </td> <td width="52"> <font color="#00FF00" size='+3'><b><font color="#00FA00" face="楷体_GB2312">绿</font></b></font> </td> <td width="46"> <input name="green-" type="button" value=" - 1" onclick="downgreen(1)"> </td> <td width="58"> <input name="green-" type="button" value=" - 10 " onclick="downgreen(10)"> </td> <td width="52"> <input name="green-" type="button" value=" -50 " onclick="downgreen(50)"> </td> <td width="29"> <input type="text" name="gr" size='3'> </td> </tr> </table> </form>