脚本说明:
把如下代码加入<body>区域中
<SCRIPT language=JavaScript>
var HexCharacters="0123456789ABCDEF";
function HexValue(decimal)
{
return HexCharacters.charAt((decimal>>4)&0xf)+HexCharacters.charAt(decimal&0xf)
}
function DecValue(hexadecimal)
{
return parseInt(hexadecimal.toUpperCase(),16)
}
function setColor(colorString)
{
document.HexConvert.HexRed.value=colorString.substring(0,2)
document.HexConvert.HexGreen.value=colorString.substring(2,4)
document.HexConvert.HexBlue.value=colorString.substring(4,6)
document.HexConvert.DecRed.value=DecValue(document.HexConvert.HexRed.value)
document.HexConvert.DecGreen.value=DecValue(document.HexConvert.HexGreen.value)
document.HexConvert.DecBlue.value=DecValue(document.HexConvert.HexBlue.value)
}
function DecFixed(decimal)
{
return Math.min(parseFloat(Math.abs(Math.floor(decimal))), 255)
}
function HexFixed(hexadecimal)
{
return HexValue(Math.min(parseFloat(Math.abs(Math.floor(DecValue(hexadecimal)))), 255))
}
function SyncDecimal()
{
document.HexConvert.DecRed.value=DecFixed(document.HexConvert.DecRed.value)
document.HexConvert.HexRed.value=HexValue(document.HexConvert.DecRed.value)
document.HexConvert.DecBlue.value=DecFixed(document.HexConvert.DecBlue.value)
document.HexConvert.HexBlue.value=HexValue(document.HexConvert.DecBlue.value)
document.HexConvert.DecGreen.value=DecFixed(document.HexConvert.DecGreen.value)
document.HexConvert.HexGreen.value=HexValue(document.HexConvert.DecGreen.value)
Preview()
return
}
function SyncHex()
{
document.HexConvert.HexRed.value=HexFixed(document.HexConvert.HexRed.value)
document.HexConvert.DecRed.value=DecValue(document.HexConvert.HexRed.value)
document.HexConvert.HexGreen.value=HexFixed(document.HexConvert.HexGreen.value)
document.HexConvert.DecGreen.value=DecValue(document.HexConvert.HexGreen.value)
document.HexConvert.HexBlue.value=HexFixed(document.HexConvert.HexBlue.value)
document.HexConvert.DecBlue.value=DecValue(document.HexConvert.HexBlue.value)
Preview()
return
}
function Preview()
{
if (navigator.appName != "Netscape")
{
self.frames[0].document.bgColor=document.HexConvert.HexRed.value+document.HexConvert.HexGreen.value+document.HexConvert.HexBlue.value
}
else
{
document.bgColor=document.HexConvert.HexRed.value+document.HexConvert.HexGreen.value+document.HexConvert.HexBlue.value
}
return
}
</SCRIPT>
<SCRIPT language=JavaScript>
if (navigator.appName != "Netscape")
{
document.write ('<body background="/parch.jpg" bgcolor="#ede2cd" text="#000000" link="#000066" alink="#dddddd" vlink="#993300" topmargin="0" marginheight=0>')
}
else
{
document.write ('<body bgcolor="#ffffff" text="#000000" link="#000066" alink="#dddddd" vlink="#993300" topmargin="0">')
}
</SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD>
<FORM name=HexConvert>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 width=400 border=0>
<TBODY>
<TR>
<TD align=middle width=400 bgColor=#e6e6e6>
<TABLE cellSpacing=5 cellPadding=5 width=400 bgColor=#e0e0e0
border=5>
<TBODY>
<TR>
<TD align=middle>
<TABLE border=0>
<TBODY>
<TR>
<TD align=middle><A
href="javascript:%20document.HexConvert.DecRed.value=document.HexConvert.DecRed.value*1+10;SyncDecimal();">[+]</A><BR><INPUT
onblur=SyncDecimal(); onfocus=DecRed.select()
maxLength=3 size=3 value=255 name=DecRed><BR><A
href="javascript:%20document.HexConvert.DecRed.value=document.HexConvert.DecRed.value*1-10;SyncDecimal();">[-]</A><BR></TD>
<TD align=middle><A
href="javascript:%20document.HexConvert.DecGreen.value=document.HexConvert.DecGreen.value*1+10;SyncDecimal();">[+]</A><BR><INPUT
onblur=SyncDecimal(); onfocus=DecGreen.select()
maxLength=3 size=3 value=255 name=DecGreen><BR><A
href="javascript:%20document.HexConvert.DecGreen.value=document.HexConvert.DecGreen.value*1-10;SyncDecimal();">[-]<BR></A></TD>
<TD align=middle><A
href="javascript:%20document.HexConvert.DecBlue.value=document.HexConvert.DecBlue.value*1+10;SyncDecimal();">[-]</A><BR><INPUT
onblur=SyncDecimal(); onfocus=DecBlue.select()
maxLength=3 size=3 value=255 name=DecBlue><BR><A
href="javascript:%20document.HexConvert.DecBlue.value=document.HexConvert.DecBlue.value*1-10;SyncDecimal();">[-]</A><BR></TD></TR>
<TR>
<TD align=middle><FONT face=Arial,Helvetica
size=1>RED<BR></FONT></TD>
<TD align=middle><FONT face=Arial,Helvetica
size=1>GREEN<BR></FONT></TD>
<TD align=middle><FONT face=Arial,Helvetica
size=1>BLUE<BR></FONT></TD></TR></TBODY></TABLE></TD>
<TD align=middle>
<TABLE border=0>
<TBODY>
<TR>
<TD align=middle><INPUT onblur=SyncHex();
onfocus=HexRed.select() maxLength=2 size=2
value=FF name=HexRed> </TD>
<TD align=middle><INPUT onblur=SyncHex();
onfocus=HexGreen.select() maxLength=3 size=2
value=FF name=HexGreen> </TD>
<TD align=middle><INPUT onblur=SyncHex();
onfocus=HexBlue.select() maxLength=3 size=2
value=FF name=HexBlue> </TD></TR>
<TR>
<TD align=middle><FONT face=Arial,Helvetica
size=1>RED<BR></FONT></TD>
<TD align=middle><FONT face=Arial,Helvetica
size=1>GREEN<BR></FONT></TD>
<TD align=middle><FONT face=Arial,Helvetica
size=1>BLUE<BR></FONT></TD></TR>
<TR>
<TD align=middle colSpan=3><FONT face=宋体
size=3>十六进制RGB颜色值<BR></FONT></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD align=middle>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR height=5>
<TD bgColor=#000000><A
href="javascript:%20setColor('000000');Preview();"> </A><BR></TD>
<TD bgColor=#080808><A
href="javascript:%20setColor('080808');Preview();"> </A><BR></TD>
<TD bgColor=#101010><A
href="javascript:%20setColor('101010');Preview();">&n