This is the corrected code that will work on all of the non-Microsoft browsers:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<style type="text/css">
h1
{
color: Blue;
}
</style>
<script type="text/javascript">
function ShowSelection() {
alert('You have selected ' + document.getElementById("SelectColor").value);
document.getElementById("BodyContent").style.backgroundColor = document.getElementById("SelectColor").value;
}
</script>
</head>
<body>
<div id="BodyContent">
<h1>
Hello World</h1>
<h2>
Welcome</h2>
This is my first web page.
<hr />
Please select a color:
<select id="SelectColor">
<option value="white">white</option>
<option value="silver">silver</option>
<option value="yellow">yellow</option>
</select>
<input id="ButtonSelect" type="button" value="Select" onclick="ShowSelection();" />
</div>
</body>
</html>