»
EnglishFrenchVietnamese

Print - Color Table onClick - JavaScriptBank.com

Full version: jsB@nk » Background » Color Table onClick
URL: https://www.javascriptbank.com/color-table-onclick.html

Color Table onClick © JavaScriptBank.comThis JavaScript will create a color table when visitors click the specified link.

Full version: jsB@nk » Background » Color Table onClick
URL: https://www.javascriptbank.com/color-table-onclick.html



JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*///<!--ie = (navigator.appName.indexOf("Microsoft")!=-1);ns = (navigator.appName.indexOf("Netscape") != -1);ns4= (ns && navigator.appVersion.indexOf("5") == -1);ns6= (ns && navigator.appVersion.indexOf("5") != -1);ns6X = 0;ns6Y = 0;function changeColor(wcolour) {if (ie){document.all["pickcolour"].style.backgroundColor = '#' + wcolour;document.all["colorbox"].style.visibility = 'hidden';}if (ns4){document.layers["pickcolour"].bgColor = '#' + wcolour;document.layers["colorbox"].visibility = false;}if (ns6){document.getElementById("pickcolour").style.backgroundColor = '#' + wcolour;document.getElementById("colorbox").style.visibility = 'hidden';}}function showColor(posX,posY){if (ie){e = window.event;with (document.all["colorbox"]){style.left = e.clientX;style.top  = e.clientY;style.visibility = 'visible';}}if (ns4){with(document.layers["colorbox"]){top = posY +18;left = posX +17;visibility = true;}}if (ns6){with(document.getElementById("colorbox").style){top = ns6Y;left = ns6X;visibility = 'visible';}}}function ns6Get(e){ns6X = e.layerX;ns6Y = e.layerY;showColor(null,null);}// init function for NS6function init() {if (ns6){  cpicker = document.getElementById("pickcolour");  cpicker.addEventListener("click", ns6Get, false);}}//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV id=pickcolour style="BACKGROUND-COLOR: #ffeedd; OVERFLOW: hidden; POSITION: relative;"><A href="javascript://http://jsbank.topcities.com" onclick=if(!ns6)showColor(this.x,this.y)>  <IMG alt="" border=0 name=colorimage src="../image/logojs.gif" width="150" height="60"></A> </DIV><!-- --Colour drop down box-- --><DIV id=colorbox style="POSITION: absolute; VISIBILITY: hidden"><TABLE bgColor=#000000 border=0 cellPadding=0 cellSpacing=0 width=252>  <TBODY>  <TR>    <TD>      <TABLE border=0 borderColor=#000000 cellPadding=0 cellSpacing=1>        <TBODY>        <TR>          <SCRIPT language=JavaScript>c = new Array();c[1] = "FF";c[2] = "CC";c[3] = "99";c[4] = "66";c[5] = "33";c[6] = "00";d = 0;for (i=1;i <=6;i++){if (i >1){document.write( "</tr>\n<tr>\n");}for (m=1;m <=6;m++){for (n=1;n <=6;n++){d++;colour = c[i] + c[m] + c[n]; document.write("<td bgcolor=\"#"+colour+"\" width=7 class=\"text\"><a href=\"#\" onClick=\"changeColor('"+colour+"')\"><img src=\"pixel.gif\" width=7 height=7 name=\"a"+d+"\" border=0></td>\n");}}}</SCRIPT>        </TR></TBODY></TABLE></TR></TBODY></TABLE></TD></TR></TABLE></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->