<select>
<option ></option>
<option style="background-color:red" value="red">red</option>
<option style="background-color:yellow" value="yellow">yellow</option>
<option style="background-color:blue" value="blue">blue</option>
</select>

解决方案 »

  1.   

    <HTML>
    <HEAD>
    <TITLE>选颜色</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <STYLE type=text/css>
    TD {FONT-SIZE: 10.8pt}
    BODY {FONT-SIZE: 10.8pt}
    BUTTON {WIDTH: 5em}
    </STYLE>
    <SCRIPT language=JavaScript>
    var SelRGB="#777777";
    var DrRGB = '';
    var SelGRAY='120';
    var GRAYvalue=100;
    var RGBvalue;
    var SelColorvalue;
    var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');function ToHex(n){
    var h, l;
    n = Math.round(n);
    l = n % 16;
    h = Math.floor((n / 16)) % 16;
    return (hexch[h] + hexch[l]);
    }function DoColor(c, l){
     var r, g, b;
      r = '0x' + c.substring(1, 3);
      g = '0x' + c.substring(3, 5);
      b = '0x' + c.substring(5, 7);
      if(l > 120){
        l = l - 120;
        r = (r * (120 - l) + 255 * l) / 120;
        g = (g * (120 - l) + 255 * l) / 120;
        b = (b * (120 - l) + 255 * l) / 120;
      }else{
        r = (r * l) / 120;
        g = (g * l) / 120;
        b = (b * l) / 120;
      }
      return '#' + ToHex(r) + ToHex(g) + ToHex(b);
    }function EndColor(){
       var i;
      if(DrRGB != SelRGB){
        DrRGB = SelRGB;
        for(i = 0; i <= 30; i ++) GrayTable.rows(i).bgColor=DoColor(SelRGB, 240 - i * 8);
      }  SelColorvalue = DoColor(RGBvalue, GRAYvalue);
      ShowColor.bgColor = SelColorvalue;
    }
    </SCRIPT>
    </head>
    <body>
    <TABLE id=ShowColor height=20 cellSpacing=0 cellPadding=0 width=80 border=1 onmouseover="trycolor.style.visibility=''"><tr><td></td></tr></TABLE>
    <DIV align=center id=trycolor style="Z-index:5;visibility: hidden;background-color: menu;width:200;" OnMOUSELEAVE="style.visibility='hidden';"> 
      <TABLE cellSpacing=10 cellPadding=0 border=0>
        <TR> 
          <TD> <TABLE id=ColorTable style="CURSOR: hand" cellSpacing=0 cellPadding=0 border=0 onClick="SelRGB=event.srcElement.bgColor;EndColor();" onMouseOver="RGBvalue=event.srcElement.bgColor;EndColor();" onMouseOut="RGBvalue=SelRGB;EndColor();">
              <SCRIPT language=JavaScript>
    function wc(r, g, b, n){
    r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
    g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
    b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15;
    document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
    }var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);  for(i = 0; i < 16; i ++){
         document.write('<TR>');
         for(j = 0; j < 30; j ++){
          n1 = j % 5;
          n2 = Math.floor(j / 5) * 3;
          n3 = n2 + 3;
          wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
          (cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
          (cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
         }
         document.writeln('</TR>');
      }
    </SCRIPT>
            </TABLE></TD>
          <TD> <TABLE id=GrayTable style="CURSOR: hand" cellSpacing=0 cellPadding=0 border=0 onclick="SelGRAY=event.srcElement.title;EndColor();" onMouseOver="GRAYvalue=event.srcElement.title;EndColor();" onMouseOut="GRAYvalue=SelGRAY;EndColor();">
              <SCRIPT language=JavaScript>
      for(i = 255; i >= 0; i -= 8.5)
         document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
    </SCRIPT>
            </TABLE></TD>
        </TR>
      </TABLE>
    </DIV>
    </HTML>
      

  2.   

    再改改,效果更好点:<HTML>
    <HEAD>
    <TITLE>颜色</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <STYLE type=text/css>
    TD {FONT-SIZE: 10.8pt}
    BODY {FONT-SIZE: 10.8pt}
    BUTTON {WIDTH: 5em}
    </STYLE>
    <SCRIPT language=JavaScript>
    var SelRGB="";
    var DrRGB = '';
    var SelGRAY='120';
    var GRAYvalue=120;
    var RGBvalue;
    var SelColorvalue;
    var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');function ToHex(n){
    var h, l;
    n = Math.round(n);
    l = n % 16;
    h = Math.floor((n / 16)) % 16;
    return (hexch[h] + hexch[l]);
    }function DoColor(c, l){
     var r, g, b;
      r = '0x' + c.substring(1, 3);
      g = '0x' + c.substring(3, 5);
      b = '0x' + c.substring(5, 7);
      if(l > 120){
        l = l - 120;
        r = (r * (120 - l) + 255 * l) / 120;
        g = (g * (120 - l) + 255 * l) / 120;
        b = (b * (120 - l) + 255 * l) / 120;
      }else{
        r = (r * l) / 120;
        g = (g * l) / 120;
        b = (b * l) / 120;
      }
      return '#' + ToHex(r) + ToHex(g) + ToHex(b);
    }function EndColor(){
       var i;
      if(DrRGB != SelRGB){
        DrRGB = SelRGB;
        for(i = 0; i <= 30; i ++) GrayTable.rows(i).bgColor=DoColor(SelRGB, 240 - i * 8);
      }  SelColorvalue = DoColor(RGBvalue, GRAYvalue);
      ShowColor.bgColor = SelColorvalue;
    }
    </SCRIPT>
    </head>
    <body>
    <TABLE id=ShowColor bgcolor=#ff00c0 height=20 cellSpacing=0 cellPadding=0 width=80 border=1 onmouseover="trycolor.style.visibility='';"><tr><td></td></tr></TABLE>
    <!--这个表格的底色是选好的颜色,可在此处赋初始值//--><DIV align=center id=trycolor style="position:absolute;Z-index:5;visibility: hidden;background-color: menu;width:200;" OnMOUSELEAVE="style.visibility='hidden';"> 
      <TABLE cellSpacing=10 cellPadding=0 border=0>
        <TR> 
          <TD> <TABLE id=ColorTable style="CURSOR: hand" cellSpacing=0 cellPadding=0 border=0 onClick="SelRGB=event.srcElement.bgColor;EndColor();" onMouseOver="RGBvalue=event.srcElement.bgColor;EndColor();" onMouseOut="RGBvalue=SelRGB;EndColor();">
              <SCRIPT language=JavaScript>
    function wc(r, g, b, n){
    r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
    g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
    b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15;
    document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
    }var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);  for(i = 0; i < 16; i ++){
         document.write('<TR>');
         for(j = 0; j < 30; j ++){
          n1 = j % 5;
          n2 = Math.floor(j / 5) * 3;
          n3 = n2 + 3;
          wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
          (cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
          (cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
         }
         document.writeln('</TR>');
      }
    </SCRIPT>
            </TABLE></TD>
          <TD> <TABLE id=GrayTable style="CURSOR: hand" cellSpacing=0 cellPadding=0 border=0 onclick="SelGRAY=event.srcElement.title;EndColor();" onMouseOver="GRAYvalue=event.srcElement.title;EndColor();" onMouseOut="GRAYvalue=SelGRAY;EndColor();">
              <SCRIPT language=JavaScript>
      for(i = 255; i >= 0; i -= 8.5) document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
      if(SelRGB=='') SelRGB=ShowColor.bgColor;
      for(i=0;i<=30;i++) GrayTable.rows(i).bgColor=DoColor(SelRGB, 240 - i * 8);
    </SCRIPT>
            </TABLE></TD>
        </TR>
      </TABLE>
    </DIV>
    fasdfsdfsd
    <br>sadfasfd
    </HTML>
      

  3.   

    <HTML>
    <HEAD>
    <TITLE>&Ntilde;&Otilde;&Eacute;&laquo;</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <STYLE TYPE="text/css">
     td {font-size: 10.8pt}
     body {font-size: 10.8pt}
     BUTTON {width:5em}
    </STYLE><SCRIPT LANGUAGE=JavaScript>
    var SelRGB = '';
    var DrRGB = '';
    var SelGRAY = '120';var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');function ToHex(n)
    { var h, l; n = Math.round(n);
    l = n % 16;
    h = Math.floor((n / 16)) % 16;
    return (hexch[h] + hexch[l]);
    }function DoColor(c, l)
    { var r, g, b;  r = '0x' + c.substring(1, 3);
      g = '0x' + c.substring(3, 5);
      b = '0x' + c.substring(5, 7);
      
      if(l > 120)
      {
        l = l - 120;    r = (r * (120 - l) + 255 * l) / 120;
        g = (g * (120 - l) + 255 * l) / 120;
        b = (b * (120 - l) + 255 * l) / 120;
      }else
      {
        r = (r * l) / 120;
        g = (g * l) / 120;
        b = (b * l) / 120;
      }  return '#' + ToHex(r) + ToHex(g) + ToHex(b);
    }function EndColor()
    { var i;  if(DrRGB != SelRGB)
      {
        DrRGB = SelRGB;
        for(i = 0; i <= 30; i ++)
          GrayTable.rows(i).bgColor = DoColor(SelRGB, 240 - i * 8);
      }  SelColor.value = DoColor(RGB.innerText, GRAY.innerText);
      ShowColor.bgColor = SelColor.value;
    }
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onclick>
      SelRGB = event.srcElement.bgColor;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseover>
      RGB.innerText = event.srcElement.bgColor;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseout>
      RGB.innerText = SelRGB;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onclick>
      SelGRAY = event.srcElement.title;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseover>
      GRAY.innerText = event.srcElement.title;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseout>
      GRAY.innerText = SelGRAY;
      EndColor();
    </SCRIPT><SCRIPT LANGUAGE=JavaScript FOR=Ok EVENT=onclick>
      window.returnValue = SelColor.value;
      window.close();
    </SCRIPT></HEAD><BODY bgcolor=menu><div align="center"><center><table border="0" cellspacing="10" cellpadding="0"><tr><td>
    <TABLE ID=ColorTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:hand'>
    <SCRIPT LANGUAGE=JavaScript>
    function wc(r, g, b, n)
    {
    r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
    g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
    b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15; document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
    }var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);  for(i = 0; i < 16; i ++)
      {
         document.write('<TR>');
         for(j = 0; j < 30; j ++)
         {
          n1 = j % 5;
          n2 = Math.floor(j / 5) * 3;
          n3 = n2 + 3;      wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
          (cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
          (cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
         }     document.writeln('</TR>');
      }
    </SCRIPT>
    </TABLE></td><td>
    <TABLE ID=GrayTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:hand'>
    <SCRIPT LANGUAGE=JavaScript>
      for(i = 255; i >= 0; i -= 8.5)
         document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
    </SCRIPT>
    </TABLE></td></tr></table></center></div><div align="center"><center><table border="0" cellspacing="10" cellpadding="0">
    <tr><td rowspan="2" align="center">
    &Ntilde;&iexcl;&Ouml;&ETH;&Eacute;&laquo;&sup2;&Ecirc;<table ID=ShowColor border="1" width="40" height="30" cellspacing="0" cellpadding="0">
    <tr><td></td></tr></table></td>
    <td rowspan="2">&raquo;ù&Eacute;&laquo;: <SPAN ID=RGB></SPAN><BR>
    &Aacute;&Aacute;&para;&Egrave;: <SPAN ID=GRAY>120</SPAN><BR>
    &acute;ú&Acirc;&euml;: <INPUT TYPE=TEXT SIZE=7 ID=SelColor></td>
    <td><BUTTON ID=Ok TYPE=SUBMIT>&Egrave;·&para;¨</BUTTON></td></tr>
    <tr><td><BUTTON ONCLICK="window.close();">&Egrave;&iexcl;&Iuml;&ucirc;</BUTTON></td></tr></table></center></div></BODY>   
    </HTML>
      

  4.   

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <!--- Designed By Fellow 12/2001 --->
    <!--- Copyright(c)Fellow's Own World,2001 --->
    <META name="author" content="[email protected]">
    <META NAME="DESCRIPTION" CONTENT="Fellow's Own World">
    <style type="text/css">
    <!--
    body {font:menu}
    td,selcet,input {  font:menu}
    .memo {  border: 1px #dddddd solid}
    .button {  border-color: #CCCCCC #666666 #666666 #CCCCCC; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    .cursorcross {  cursor: crosshair}
    .cursorhand {  cursor: hand}
    -->
    </style>
    </head><body bgcolor="#FFFFFF" text="#000000">
    <div align="center"><b><font color="#003366">Fellow&Aring;&AElig;&micro;÷&Eacute;&laquo;°&aring; Ver1.1</font></b><br>
    <br>
    </div>
    <table border="0" cellspacing="1" cellpadding="3" width="350" align="center" bgcolor="#dddddd">
    <tr bgcolor="#FFFFFF"> 
    <td width="10%" align="center"> 
    <select name="select1" onchange="selectchg(this.value)">
    <option value="1" selected>&ordm;ì</option>
    <option value="2">&Acirc;&Igrave;</option>
    <option value="3">&Agrave;&para;</option>
    <option value="4">&raquo;&Ograve;</option>
    </select>
    </td>
    <td width="90%" align="center"> 
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr> 
    <td align="right"> 
    <input type="text" name="text1" class="memo" size="10">
    <input type="button" name="Button2" value="&gt;&gt;" class="button" onClick="choosecolor()">
    </td>
    <td align="right" width="3%">&nbsp;</td>
    <td width="30%"> 
    <table width="40" border="0" cellspacing="1" cellpadding="0" height="20"  class="cursorcross">
    <tr> 
    <td id="customcolor" bgcolor="#FFFFFF"  onMouseOver="showcolor(this)">&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
    <td width="10%" align="center"> 
    <table id="tableleft" border="0" cellspacing="1" cellpadding="0" class="cursorhand">
    <script language="VBScript">
    function hexit(which)
    hexit=hex(which)
    end function
    </script>
    <script language="JavaScript">
    for(i=0;i<=15;++i)
    {document.write('<tr><td align="center">'+ hexit(0+i*17) +'</td><td id="tdleft' + i +'" bgcolor="rgb('+ (0+i*17) + ',0,0)" width="15" height="15" onclick="changeright(this.num)" onmouseover="showcolor(this)"></td></tr>')
     document.all['tdleft' + i].num=i
    }
    </script>
    </table>
    </td>
    <td align="center" width="90%"> 
    <table id="tableleft" border="0" cellspacing="1" cellpadding="0" class="cursorcross">
    <script language="JavaScript">
    document.write('<tr><td></td>')
    for(i=0;i<=15;++i)
    {document.write('<td align="center">'+ hexit(0+i*17) +'</td>')}
    document.write('</tr>')for(i=0;i<=15;++i)
    {document.write('<tr>')
     document.write('<td align="center">'+ hexit(0+i*17) +'</td>')
     for(j=0;j<=15;++j)
      {document.write('<td id="tdrightr' + i + 'c' + j +'" bgcolor="rgb(0,'+ (0+i*17) + ',' + (0+j*17) + ')" width="15" height="15" onmouseover="showcolor(this)" onclick="clickright(this)"></td>')}
     document.write('</tr>')
    }</script>
    </table>
    </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
    <td colspan="2" height="20">&iexcl;¤&iquest;&Eacute;&Ntilde;&iexcl;16*16*16&Ouml;&Ouml;&Ntilde;&Otilde;&Eacute;&laquo;&iexcl;&pound;<br>
    &iexcl;¤&micro;&yen;&raquo;÷×ó±&szlig;&micro;&Auml;&Ntilde;&Otilde;&Eacute;&laquo;&raquo;á&micro;&Atilde;&micro;&frac12;&cedil;ü&para;à&micro;&Auml;&Ntilde;&Otilde;&Eacute;&laquo;&iexcl;&pound;<br>
    &iexcl;¤&micro;&yen;&raquo;÷&Oacute;&Ograve;±&szlig;&micro;&Auml;&Ntilde;&Otilde;&Eacute;&laquo;&raquo;á&sup1;&Igrave;&para;¨&Ntilde;&iexcl;&Egrave;&iexcl;&micro;&Auml;&Ntilde;&Otilde;&Eacute;&laquo;&iexcl;&pound; <br>
    &iexcl;¤&Ecirc;&auml;&Egrave;&euml;&iquest;ò&iquest;&Eacute;&Ograve;&Ocirc;×&Ocirc;&para;¨&Ograve;&aring;&Ntilde;&Otilde;&Eacute;&laquo;&iexcl;&pound;</td>
    </tr>
    </table>
    <script language="JavaScript">
    function selectchg(which)
    {switch(which)
      {case '1' :leftR();break;
       case '2' :leftG();break;
       case '3' :leftB();break;
       case '4' :leftA();break;
      }
    }
    function leftR()
    {for(i=0;i<=15;++i)
       {document.all['tdleft'+i].bgColor='rgb('+ (0+i*17) + ',0,0)'}
     rightR(0)
    }
    function leftG()
    {for(i=0;i<=15;++i)
       {document.all['tdleft'+i].bgColor='rgb(0,'+ (0+i*17) + ',0)'}
     rightG(0)
    }
    function leftB()
    {for(i=0;i<=15;++i)
       {document.all['tdleft'+i].bgColor='rgb(0,0,'+ (0+i*17) + ')'}
     rightB(0)
    }
    function leftA()
    {for(i=0;i<=15;++i)
       {document.all['tdleft'+i].bgColor='rgb('+ (0+i*17) + ','+ (0+i*17) + ','+ (0+i*17) + ')'}
     rightA()
    }
    function rightR(which)
    {for(i=0;i<=15;++i)
       {for(j=0;j<=15;++j)
         {document.all['tdrightr' + i + 'c' + j].bgColor='rgb(' + (0+which*17) + ',' + (0+i*17) + ','+ (0+j*17) + ')'}
        }
    }
    function rightG(which)
    {for(i=0;i<=15;++i)
       {for(j=0;j<=15;++j)
         {document.all['tdrightr' + i + 'c' + j].bgColor='rgb(' + (0+i*17) + ',' + (0+which*17) +  ',' + (0+j*17) + ')'}
        }
    }
    function rightB(which)
    {for(i=0;i<=15;++i)
       {for(j=0;j<=15;++j)
         {document.all['tdrightr' + i + 'c' + j].bgColor='rgb(' + (0+i*17) + ','+ (0+j*17)+ ',' + (0+which*17) + ')'}
        }
    }
    function rightA()
    {for(i=0;i<=15;++i)
       {for(j=0;j<=15;++j)
         {document.all['tdrightr' + i + 'c' + j].bgColor='rgb(' + (0+i*16+j) + ','+ (0+i*16+j)+ ',' + (0+i*16+j) + ')'}
        }
    }
    var rightclicked=false
    function clickright(which)
    {if(rightclicked){rightclicked=false;showcolor(which)}else{rightclicked=true}
    }
    function changeright(which)
    {switch(select1.value)
      {case '1' :rightR(which);break;
       case '2' :rightG(which);break;
       case '3' :rightB(which);break;
     }
    }
    function showcolor(which)
    {if(rightclicked)return;
     text1.value=which.bgColor
     choosecolor()
    }
    function choosecolor()
    {customcolor.bgColor=text1.value
    }
    </script>
    </body>
    </html>