»
EnglishFrenchVietnamese

Print - Inverse color Previewer - JavaScriptBank.com

Full version: jsB@nk » Background » Inverse color Previewer
URL: https://www.javascriptbank.com/inverse-color-previewer.html

Inverse color Previewer © JavaScriptBank.comThis JavaScript allow user to priview inverse code of a color.

Full version: jsB@nk » Background » Inverse color Previewer
URL: https://www.javascriptbank.com/inverse-color-previewer.html



CSS
<STYLE type=text/css>TD {FONT: bold 16pt arial; TEXT-ALIGN: right}INPUT {BACKGROUND-COLOR: #d3d3e3; BORDER-BOTTOM: #ffcc11 1px solid; BORDER-LEFT: #ffcc11 1px solid; BORDER-RIGHT: #ffcc11 1px solid; BORDER-TOP: #ffcc11 1px solid}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<SCRIPT language=javascript>function inverse(theString){if(theString.length<6||theString.length>6){window.alert('You Must Enter a six digit color code')document.rin.reset();return false;}a=theString.slice(0,2);b=theString.slice(2,4);c=theString.slice(4,6);a1=16*giveHex(a.slice(0,1));a2=giveHex(a.slice(1,2));a=a1+a2;b1=16*giveHex(b.slice(0,1));b2=giveHex(b.slice(1,2));b=b1+b2;c1=16*giveHex(c.slice(0,1));c2=giveHex(c.slice(1,2));c=c1+c2;newColor=DecToHex(255-a)+""+DecToHex(255-b)+""+DecToHex(255-c)alert("You Entered "+theString+" and \nYour inversed Color is \n"+newColor);myText="<table cellspacing='4' bgColor='#efefef' border='0' width='50%'><tr><td bgcolor='#"+""+newColor+"'><font color='#"+theString+"' size=2>Background='#"+newColor+"'<"+"\/font><\/td><td bgColor='#"+newColor+"'><font color='#"+theString+"' face=arial"+">Snippet1<\/font><\/td><\/tr><tr><td bgcolor='#"+theString+"'><font color='#"+""+newColor+"' size=2>Background='#"+theString+"'</font><\/td><td bgColor="+"'#"+theString+"'><font color='#"+newColor+"'>Snippet2<\/font><\/td><\/tr><\/table>"stat.innerHTML=myText}var hexbase="0123456789ABCDEF";function DecToHex(number) {          return hexbase.charAt((number>> 4)& 0xf)+ hexbase.charAt(number& 0xf);        }function giveHex(s){s=s.toUpperCase();return parseInt(s,16);}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->