»
EnglishFrenchVietnamese

Print - Color Bar - JavaScriptBank.com

Full version: jsB@nk » Misc » Color Bar
URL: https://www.javascriptbank.com/color-bar.html

Color Bar © JavaScriptBank.comUsing a mix of JavaScript and CSS, a fashionable table with cells that change colors can be added to any Web page. It uses document.write(); so make sure to embed it in a table.

Full version: jsB@nk » Misc » Color Bar
URL: https://www.javascriptbank.com/color-bar.html



CSS
<STYLE>.1 {BACKGROUND-COLOR: lightblue}.2 {BACKGROUND-COLOR: cyan}.3 {BACKGROUND-COLOR: blue}.4 {BACKGROUND-COLOR: darkblue}.5 {BACKGROUND-COLOR: black}</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>var CELLS = 75;function DrawBar() {document.write('<center><table id="theTable" border=1 cellpadding=0 bordercolor=black cellspacing=0 width=50% height=15></center><tr>');for (i=0; i<=CELLS; i++) {document.write('<td></td>');}document.write('</tr></table>');colors('theTable');}function colors(id) {var table = document.getElementById(id);   var rows = table.getElementsByTagName("td");   for(i = 0; i <= CELLS; i++){rnum = Math.floor(Math.random() * 5 + 1);rows[i].className = rnum;}setTimeout("colors('theTable')", 250);}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<SCRIPT>DrawBar();</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->