The site can switch a few sets of CSS style has not been a novelty. We all know how to get it. This article describes the same switching style. But a little adjustment was made. The site will automatically adjust the site style based on the time of day. The author for the site produced in the morning, afternoon, night three sets of skin, mainly produced a background. 12 before the system will use the morning skin, after 12 points, the site will automatically replace the style of the afternoon, 5 points after the replacement of the style of the night.
The main function of the implementation is to rely on the head of this section of the judgment code, it is easy to understand. Be interested to try it on your own.
<link rel= "stylesheet" type= "Text/css"
href= "<?php $hour = Date (" H "); if ($hour <) echo "MORNING.CSS"; ElseIf ($hour <) echo "DAY.CSS"; else echo "Night.css";?>
"/>
ASP version code is as follows:
<link rel= "stylesheet" type= text/css "href=" <%
If hour (now) <12 then
Response.Write "A.css"
Else
If hour (now) <17 then
Response.Write "B.css"
Else
Response.Write "C.css"
End If
End If
%> "/>