<!DOCTYPE html>
<html>
<head>
<title>Unit 2 - Q13</title>
<script type="text/javascript">
function color()
{
var clr=document.getElementById('clr').value;
if(clr=='red')
document.bgColor='red';
if(clr=='green')
document.bgColor='green';
if(clr=='blue')
document.bgColor='blue';
if(clr=='white')
document.bgColor='white';
if(clr=='black')
document.bgColor='black';
}
</script>
</head>
<body>
<center>
<form>
<select name="clr" id="clr">
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="white">White</option>
<option value="black">Black</option>
</select>
<input type="button" value="Change Color" onClick="color()">
</form>
</center>
</body>
</html>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.