Here's the ASP.Net control I was looking to alter:
<asp:Image ID="imageWorldMap" runat="server" Width="100%" Height="100%" />
And here's the JavaScript that gets called when the page loads:
<script type="text/javascript">
// Set the background according to what time of the day it is on the user's computer.
function SetBackground()
{
var now = new Date();
var hr = now.getHours();
var img;
if (hr >= 6 && hr < 18)
{
img = "Images/worldMap.jpg";
}
else
{
img = "Images/worldMapNight.jpg";
}
document.getElementById('<%=imageWorldMap.ClientID%>').src = img;
}
</script>
No comments:
Post a Comment