I have this page i created that does 2 things. First it displays an image based on the time. This works. Then i added a second script that allows a user to change the color of text. When each script is run separately (different pages) no issue.
if i combine them only the image one runs. Any ideas would be appreciated.
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body onload="imagetime()">
<br />
<div align="center">
<div align="center" id="colorMsg" style="font-size:25px;width:100px;height:100px;padding:5px;">
<br>
<br>
Welcome:
<script>
function changeColor(){
var newColor = document.getElementById('colorPicker').value;
document.getElementById('colorMsg').style.color = newColor;
}
</script>
<select id="colorPicker" onChange="JavaScript:changeColor()">
<option value="purple">None</option>
<option value="red">Red</option>
<option value="orange">Orange</option>
<option value="maroon">Maroon</option>
<option value="blue">Blue</option>
</select>
</div>
</div>
<br />
<div>
<script>
function imagetime() {
// man means morning, afternoon or night
var current= new Date()
var man=current.getHours()
if (man<=8) {
document.write('<center><img src="1.jpg"></center>'); //display the morning image
}
else if (man<16) {
document.write('<center><img src="2.jpg"></center>'); //display the afternoon image
}
else {
document.write('<center><img src="3.jpg"></center>');//display the evening image
}
}
</script>
</div>
<p id="imagedest"></p>
<br/>
<br />
</body>
</html>