»
EnglishFrenchVietnamese

Print - Farvarite color from Prompt - JavaScriptBank.com

Full version: jsB@nk » Background » Farvarite color from Prompt
URL: https://www.javascriptbank.com/background-color-from-prompt.html

Farvarite color from Prompt © JavaScriptBank.comThis JavaScript is another neat way to spice up your webpage with JavaScript. Visitors just type their favorite color in the box and click OK button. The background is instantly changed to their favorite color.

Full version: jsB@nk » Background » Farvarite color from Prompt
URL: https://www.javascriptbank.com/background-color-from-prompt.html



HTML
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/// Ask the user for a color preferencevar displayColor = prompt("What background color do you want?", "yellow")// The default text color is blackvar textColor = "black"// If the user chooses a black background, change the text to white// so it is visibleif (displayColor == "black" || displayColor == "#000000" || displayColor == null) {    textColor = "white"}// Display page contentdocument.writeln("<BODY BGCOLOR=" + displayColor + " TEXT=" + textColor + "><b>You chose " + displayColor + "</b><br></BODY>")//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->