Gli otto colori che sicuramente appariranno fedeli su qualsiasi dispositivo
- scegli il mix di colori fondamentali Red, Green e Blue
- vedi il risultato e leggi il nome e il codice RGB
CODICE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
<script> var nomi2=Array("black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"); function cambia2() { var nome2=0; var r, g, b, colore; if(document.colore2.radioR[0].checked) { r="00"; } else { r="FF"; nome2 +=4; } if(document.colore2.radioG[0].checked) { g="00"; } else { g="FF"; nome2 +=2; } if(document.colore2.radioB[0].checked) { b="00"; } else { b="FF"; nome2 +=1; } document.colore2.coloreR.style.background="#"+r+"0000"; document.colore2.coloreG.style.background="#00"+g+"00"; document.colore2.coloreB.style.background="#0000"+b; colore="#"+r+g+b; document.colore2.colore.style.background=colore; document.colore2.txtColore.value=colore; document.colore2.nome.value=nomi2[nome2]; } </script> <form name="colore2"> <table cellspacing="0" cellpadding="3"> <tbody> <tr> <td><b>RGB</b></td> <td><input name="colore" readonly="readonly" size="30" type="text" value=" " /></td> <td><input name="nome" readonly="readonly" size="10" type="text" value="white" /> <input name="txtColore" readonly="readonly" size="10" type="text" value="#000000" /></td> </tr> <tr> <td>Red</td> <td><input name="coloreR" readonly="readonly" size="30" type="text" value=" " /></td> <td><input name="radioR" type="radio" onclick="cambia2()" />00 <input checked="checked" name="radioR" type="radio" onclick="cambia2()" />FF</td> </tr> <tr> <td>Green</td> <td><input name="coloreG" readonly="readonly" size="30" type="text" value=" " /></td> <td><input name="radioG" type="radio" onclick="cambia2()" />00 <input checked="checked" name="radioG" type="radio" onclick="cambia2()" />FF</td> </tr> <tr> <td>Blue</td> <td><input name="coloreB" readonly="readonly" size="30" type="text" value=" " /></td> <td><input name="radioB" type="radio" onclick="cambia2()" />00 <input checked="checked" name="radioB" type="radio" onclick="cambia2()" />FF</td> </tr> </tbody> </table> </form> <script> document.colore2.radioR.checked=true; document.colore2.radioG.checked=true; document.colore2.radioB.checked=true; cambia2(); </script> |