⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 color-chooser.html

📁 Use scipts to get Background effects on your web Page
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</center>
<P>
<P>
<a name="source">
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td BGCOLOR=yellow><font FACE="helvetica,arial,geneva"><b>JavaScript Source Code 3000:  BG Effects:  Color Chooser</b>
<p>Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s).  The script is yours!!!
<br><br></font></td></tr>
<tr><td BGCOLOR=yellow ALIGN=CENTER>
<form NAME="copy">

<DIV align="center">
<input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE="text" NAME="total" VALUE="Script Size:  7.96 KB" size=24>
</DIV>

<textarea NAME="txt" ROWS=20 COLS=75 WRAP=VIRTUAL>

&lt;!-- TWO STEPS TO INSTALL COLOR CHOOSER:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  --&gt;

&lt;!-- STEP ONE: Paste this code into the HEAD of your HTML document  --&gt;

&lt;HEAD&gt;

&lt;SCRIPT LANGUAGE="JavaScript"&gt;
&lt;!-- Original:  Edward Kodgis II (eddiaka@hotmail.com) --&gt;
&lt;!-- Web Site:  http://members.spree.com/entertainment/squeesoft/ --&gt;

&lt;! &gt;
&lt;! &gt;

&lt;!-- Begin
redValue = 255;
blueValue = 255;
greenValue = 255;
redForeValue = 0;
blueForeValue = 0;
greenForeValue = 0;
maxValue = 255;
hexValues = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
i = 0;
function toHex(integer) {
hexDigit1 = Math.floor(integer / 16);
hexDigit2 = (integer % 16);
return hexValues[hexDigit1] + hexValues[hexDigit2];
}
function shiftFG() {
redFGHex = toHex(redForeValue);
blueFGHex = toHex(blueForeValue);
greenFGHex = toHex(greenForeValue);
bigFGHex = redFGHex + greenFGHex + blueFGHex;
document.fgColor = bigFGHex;
document.Interface.fgHex.value = bigFGHex;
document.Interface.redFG.value = redForeValue;
document.Interface.blueFG.value = blueForeValue;
document.Interface.greenFG.value = greenForeValue;
}
function shiftBG() {
redHex = toHex(redValue);
blueHex = toHex(blueValue);
greenHex = toHex(greenValue);
bigHex = redHex + greenHex + blueHex;
document.bgColor = bigHex;
document.Interface.bgHex.value = bigHex;
document.Interface.red.value = redValue;
document.Interface.blue.value = blueValue;
document.Interface.green.value = greenValue;
}
function incrementRed(isBackground) {
if (isBackground == true ) {
redValue = redValue + 8;
if (redValue &gt; maxValue) { 
redValue = 0;
}
shiftBG();
}
if (isBackground == false) { 
redForeValue = redForeValue + 8;
if (redForeValue &gt; maxValue) {
redForeValue = 0;
}
shiftFG();
   }
}
function decrementRed(isBackground) {
if (isBackground == true) {
redValue = redValue - 8;
if (redValue &lt; 0 ) {
redValue = 255;
}
shiftBG();
}
else {
redForeValue = redForeValue - 8;
if (redForeValue &lt; 0) {
redForeValue = 255;
}
shiftFG();
   }
}
function setRed(value, isBackground) {
if(value &gt; -1 && value &lt; 256) {
if( isBackground == true ) {
redValue = value;
shiftBG();
}
else {
redForeValue = value;
shiftFG();
      }
   }
}
function incrementBlue(isBackground) {
if ( isBackground == true ) {
blueValue = blueValue + 8;
if (blueValue &gt; maxValue) {
blueValue = 0;
}			
shiftBG();
}
else { 
blueForeValue = blueForeValue + 8;
if ( blueForeValue &gt; maxValue ) {
blueForeValue = 0;
}
shiftFG();
   }
}
function decrementBlue(isBackground) {
if (isBackground == true) {
blueValue = blueValue - 8;
if (blueValue &lt; 0) {
blueValue = 255;
}
shiftBG();
}
else {
blueForeValue = blueForeValue - 8;
if (blueForeValue &lt; 0) {
blueForeValue = 255;
}
shiftFG();
   }
}
function setBlue(value, isBackground) {
if (value &gt; -1 && value &lt; 256) {
if ( isBackground == true ) {
blueValue = value;
shiftBG();
}
else {
blueForeValue = value;
shiftFG();
      }
   }
}
function incrementGreen(isBackground) {
if (isBackground == true) {
greenValue = greenValue + 8;
if (greenValue &gt; maxValue) {
greenValue = 0;
}
shiftBG();
}
else {
greenForeValue = greenForeValue + 8;
if (greenForeValue &gt; maxValue) {
greenForeValue = 0;
}
shiftFG();
   }
}
function decrementGreen(isBackground) {
if (isBackground == true) {
greenValue = greenValue - 8;
if (greenValue &lt; 0 ) {
greenValue = 255;
}
shiftBG();
}
else {
greenForeValue = greenForeValue - 8;
if (greenForeValue &lt; 0) {
greenForeValue = 255;
}
shiftFG();
   }
}
function setGreen(value, isBackground) {
if ( value &gt; -1 && value &lt; 256 ) {
if ( isBackground == true ) {
greenValue = value;
shiftBG();
}
else {
greenForeValue = value;
shiftFG();
      }
   }
}
function unHex(string, fgbg) {
hex = string.toUpperCase();
counter = 0;
while (hex.charAt(0) != hexValues[counter])
counter++;
r = 16 * counter;
counter = 0;
while (hex.charAt(1) !=  hexValues[counter])
counter++;
r = r + counter;
counter = 0;
while (hex.charAt(2) != hexValues[counter])
counter++;
g = 16 * counter;
counter = 0;
while (hex.charAt(3) != hexValues[counter])
counter++;
g = g + counter;
counter = 0;
while (hex.charAt(4) != hexValues[counter])
counter++;
b = 16 * counter;
counter = 0;
while (hex.charAt(5) != hexValues[counter])
counter++;
b = b + counter;
if (fgbg == "bg") {
redValue = r;
blueValue = b;
greenValue = g;
document.Interface.red.value = redValue;
document.Interface.blue.value = blueValue;
document.Interface.green.value = greenValue;
}
if (fgbg == "fg") {
redForeValue = r;
blueForeValue = b;
greenForeValue = g;
document.Interface.redFG.value = redForeValue;
document.Interface.blueFG.value = blueForeValue;
document.Interface.greenFG.value = greenForeValue;
   }
}	
function validChar(char) {
for (j = 0; j &lt; hexValues.length; j++) {
if (char == hexValues[j]) {
return true;
   }
}
return false;
}
function isHex(string) {
if (string.length != 6) { 
return false;
}
for (k = 0; k &lt; 6; k++) {
if (! validChar(string.charAt(k))) {
return false;
   }
}
return true;
}
function setBGHex(value) {
if (isHex(value.toUpperCase())) {
document.bgColor = value;
unHex(value, "bg");
   }
}
function setFGHex(value) {
if (isHex(value.toUpperCase())) {
document.fgColor = value;
unHex(value, "fg");
   }
}
//  End --&gt;
&lt;/script&gt;

&lt;/HEAD&gt;

&lt;!-- STEP TWO: Copy this code into the BODY of your HTML document  --&gt;

&lt;BODY&gt;

&lt;center&gt;
&lt;form name=Interface&gt;
&lt;table border=4 cellspacing=0 cellpadding=4&gt;
&lt;tr&gt;
&lt;td colspan=3 align=center&gt;Background&lt;/td&gt;
&lt;td&gt;&lt;input type=text name=bgHex onKeyup="setBGHex(this.value)"&gt;&lt;/td&gt;
&lt;td colspan=2 align=center&gt;Foreground&lt;/td&gt;
&lt;td&gt;&lt;input type=text name=fgHex onKeyup="setFGHex(this.value)"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Red&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementRed(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementRed(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name="red" onKeyup="setRed(this.value, true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementRed(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementRed(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name=redFG onKeyup="setRed(this.value, false)"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Green&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementGreen(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementGreen(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name="green" onKeyup="setGreen(this.value, true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementGreen(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementGreen(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name=greenFG onKeyup="setGreen(this.value, false)"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Blue&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementBlue(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementBlue(true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name="blue" onKeyup="setBlue(this.value, true)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" + " onClick="incrementBlue(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=button value=" - " onClick="decrementBlue(false)"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type=text name=blueFG onKeyup="setBlue(this.value, false)"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/center&gt;

 

&lt;!-- Script Size:  7.96 KB --&gt;</textarea><br><font FACE="helvetica,arial,geneva"></font></td></tr>

</table>
</form>
</FONT>
</CENTER>


</center>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -