/*JavaScript Bible, Fourth Editionby Danny Goodman John Wiley & Sons CopyRight 2001*/<HTML><HEAD><SCRIPT LANGUAGE="JavaScript">function setColor(evt) { evt = (evt) ? evt : (window.event) ? window.event : "" if (evt) { var elem = (evt.target) ? evt.target : evt.srcElement if (elem.className == "palette") { document.getElementById("display").style.backgroundColor = elem.style.backgroundColor } }}document.onmouseover = setColor</SCRIPT></HEAD><BODY><H1>Layer Background Colors (W3C)</H1><HR><SCRIPT LANGUAGE="JavaScript">var oneLayervar colorTop = 100var colorLeft = 20var colorWidth = 40var colorHeight = 40var colorPalette = new Array("aquamarine","coral","forestgreen", "goldenrod","red","magenta","navy","teal")for (var i = 0; i < colorPalette.length; i++) { oneLayer = "<DIV ID='swatch" + i + "' CLASS='palette'" oneLayer += "STYLE='position:absolute; top:" + colorTop + ";" oneLayer += "left:" + ((colorWidth * i) + colorLeft) + ";" oneLayer += "width:" + colorWidth + "; height:" + colorHeight + ";" oneLayer += "background-color:" + colorPalette[i] + "'></DIV>n" document.write(oneLayer)}</SCRIPT><DIV ID="display" STYLE="position:absolute; top:150; left:80; width:200; height:200; background-color:gray"><SPAN STYLE="font-weight:bold; color:white; text-align:center">Some reversed text to test against background colors.</SPAN></DIV></BODY></HTML>
Name (required)
email (will not be published) (required)
Website