I need to change the background of my web page 3 times a day. good morning, good afternoon, and good evening. this has to be in xhtml and not use javascript or PHP. I have to do this for a class which is why I cant use these.
Tags: Web page, good morning, Data Formats, good afternoonHow Can I Change the Background of My Web Page Depending on the Time Only Using XHTML?
Previous post: Securing Web Services With WS-Security: Demystifying
{ 1 comment… read it below or add one }
<script language="JavaScript">
day=new Date() //..get the date
x=day.getHours() //..get the hour
if(x>=0 && x<4) {
document.write(‘<style type="text/css">body{background: white url(1st.jpg); color: black}"></style>’)
} else
if(x>=4 && x<12) {
document.write(‘<style type="text/css">body{background: white url(2nd.jpg); color: black}</style>’)
} else
if(x>=12 && x<18) {
document.write(‘<style type="text/css">body{background: white url(3rd.jpg); color: black}</style>’)
} else
if (x>=18 && x<24) {
document.write(‘<style type="text/css">body{background: white url(4th.jpg); color: black}</style>’)
}
</script>
You must log in to post a comment.