»
EnglishFrenchVietnamese

Print - The Select bgChanger - JavaScriptBank.com

Full version: jsB@nk » Form » Dropdown » The Select bgChanger
URL: https://www.javascriptbank.com/the-select-bgchanger.html

The Select bgChanger © JavaScriptBank.comThe code makes the background color of combo box change continually.

Full version: jsB@nk » Form » Dropdown » The Select bgChanger
URL: https://www.javascriptbank.com/the-select-bgchanger.html



JavaScript
<SCRIPT langauge="javascript">/*       By: Aaron Connelly       E-Mail: [email protected]       for non-comercial uses only - Other contact at the E-Mail address above        This Credit Must stay intact for use!!!!!!!!!!*/function change(){//The Text Colorvar color="blue"//You can change the background Colorsvar a=new Array()a[1]="gold"a[2]="red"a[3]="skyblue"a[4]="orange"a[5]="lightseagreen"a[6]="lime"a[7]="purple"a[8]="white"a[9]="salmon"a[10]="lightgrey"/*  if you add more colors just replace the 11 with one higher then the last array number Example : the array's last number is 20. So the 11 or random number will be 21.*/var r=Math.floor(Math.random() * 11) + 1document.forms[0].menuBg.style.backgroundColor=a[r]document.forms[0].menuBg.style.fontWeight="bold"document.forms[0].menuBg.style.color=colorsetTimeout("change()",100)}window.onload=change</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM><SELECT name=menuBg> <OPTION selected value=Whatever>Select a Topic<OPTION value=http://javascriptbank.com>JavaScriptBank.com  <OPTION value=http://javascriptbank.com>JavaScriptBank.com  <OPTION   value=http://www.javascriptbank.com>JavaScriptBank.com  <OPTION value=http://www.javascriptbank.com>eCHÍP<OPTION   value=Whatever>C++</OPTION></SELECT> </FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->