Create JavaScript program which have list of color in dropdown menu, if user can select any color from dropdown menu this color will set to the background of document.
CODING:
<html>
<head>
<script>
function background(bg)
{
document.bgColor=bg.options[bg.selectedIndex].value;
}
</script>
</head>
<body>
CHOOSE COLOR:
<select id="color" onClick="background(this)">
<option value="FFFFCC" >light yellow</option>
<option value="CCFFFF">light blue</option>
<option value="CCFFCC">light green</option>
<option value="gray">gray</option>
<option value="FFFFFF">white</option>
</select>
</body>
</html>
CODING:
<html>
<head>
<script>
function background(bg)
{
document.bgColor=bg.options[bg.selectedIndex].value;
}
</script>
</head>
<body>
CHOOSE COLOR:
<select id="color" onClick="background(this)">
<option value="FFFFCC" >light yellow</option>
<option value="CCFFFF">light blue</option>
<option value="CCFFCC">light green</option>
<option value="gray">gray</option>
<option value="FFFFFF">white</option>
</select>
</body>
</html>
Comments
Post a Comment