»
EnglishFrenchVietnamese

Print - Color changer on Mouse event - JavaScriptBank.com

Full version: jsB@nk » Background » Color changer on Mouse event
URL: https://www.javascriptbank.com/color-changer-on-event.html

Color changer on Mouse event © JavaScriptBank.comThis JavaScript creates two way to change background: click/move mouse on specified link.

Full version: jsB@nk » Background » Color changer on Mouse event
URL: https://www.javascriptbank.com/color-changer-on-event.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*/var backColor = new Array(); // don't change this// Enter the colors you wish to use. Follow the// pattern to use more colors.  The number in the// brackets [] is the number you will use in the// function call to pick each color.backColor[0] = '#FF0000';backColor[1] = '#00FF00';backColor[2] = '#FFC0C0';backColor[3] = '#FFFFFF';// Do not edit below this line.function changeBG(whichColor){document.bgColor = backColor[whichColor];}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<a href="#" onMouseOver="javascript:changeBG(2)">Change by placing mouse over link</a><br><a href="javascript:changeBG(1)">Change by clicking on link</a><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->