»
EnglishFrenchVietnamese

Print - Background Color Generator - JavaScriptBank.com

Full version: jsB@nk » Background » Background Color Generator
URL: https://www.javascriptbank.com/background-color-generator.html

Background Color Generator © JavaScriptBank.comAllows for the fine tuning of the window's background color via red, green, and blue color buttons. Click a textbox to change the color value manually, or use the '>' and '<' to change the amount of that color in the background.

Full version: jsB@nk » Background » Background Color Generator
URL: https://www.javascriptbank.com/background-color-generator.html



CSS
<style type="text/css">body{background-color:white;font-size:10pt;color:#00436e;font-family:sans-serif;}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/var tred=255,tgreen=255,tblue=255;function setbg(c1,c2,c3){var d=document.f;if((tred+c1)>255) tred=0;else if((tred+c1)<0) tred=255;else tred=tred+c1;if((tgreen+c2)>255) tgreen=0;else if((tgreen+c2)<0) tgreen=255;else tgreen=tgreen+c2;if((tblue+c3)>255) tblue=0;else if((tblue+c3)<0) tblue=255;else tblue=tblue+c3;d.red.value=tred.toString(16);if(d.red.value.length<2)d.red.value='0'+d.red.value;d.green.value=tgreen.toString(16);if(d.green.value.length<2)d.green.value='0'+d.green.value;d.blue.value=tblue.toString(16);if(d.blue.value.length<2)d.blue.value='0'+d.blue.value;if(document.layers)document.bgColor='#'+d.red.value+d.green.value+d.blue.value;else document.body.style.backgroundColor='#'+d.red.value+d.green.value+d.blue.value;}window.onload=function(){setbg(0,0,0);}window.onresize=function(){setbg(0,0,0);}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="f"><table border="1" cellspacing="0" cellpadding="0"><tr><td><table border="0" bgcolor="#ffedcf" cellspacing="0" cellpadding="5" width="520"><tr><td colspan="3" align="center"><font size="-1">Use the &lt;&lt; and &gt;&gt; buttons for coarse adjustment, and use the &lt; and &gt; to fine tune each color. The text area shows the values for each color as a hex value.</font></td></tr><tr><td align="center"><font color="red">Red</font></td><td align="center"><font color="green">Green</font></td><td align="center"><font color="blue">Blue</font></td></tr><tr><td align="center"><input type="text" size="2" value="00" name="red" onChange="setbg()" readonly><br><input type="button" value=" <<  "   onClick="setbg((-17),0,0)"><input type="button" value=" < "  onClick="setbg((-1),0,0)"> <input type="button" value=" > "  onClick="setbg(1,0,0)"><input type="button" value="  >> "  onClick="setbg(17,0,0)"></td><td align="center"><input type="text" size="2" value="00" name="green" onChange="setbg()" readonly><br><input type="button" value=" <<  "   onClick="setbg(0,(-17),0)"><input type="button" value=" < "  onClick="setbg(0,(-1),0)"> <input type="button" value=" > "  onClick="setbg(0,1,0)"><input type="button" value="  >> "  onClick="setbg(0,17,0)"></td><td align="center"><input type="text" size="2" value="00" name="blue" onChange="setbg()" readonly><br><input type="button" value=" <<  "   onClick="setbg(0,0,(-17))"><input type="button" value=" < "  onClick="setbg(0,0,(-1))"> <input type="button" value=" > "  onClick="setbg(0,0,1)"><input type="button" value="  >> "  onClick="setbg(0,0,17)"></td></tr></table></td></tr></table></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->