Operation is the key to the continuous growth of the site, only the content of the site for detailed and unique planning and implementation, coupled with the essential operations, the site can be in an invincible position in the competition.
Now many websites have the function of style switch, but usually can only by manual click to switch template, for personal website or niche website, if can adjust http://www.aliyun.com/zixun/aggregation/12335 according to time automatically. HTML "> website style, such as a refreshing page template during the day, and a black-toned style at night, gives visitors a refreshing feeling." This makes it easy for users to remember your site, but also highlight the site's "personality", below to introduce the implementation method.
1.ASP website Style Code
For the use of ASP architecture of the site, you can directly use the following ASP code, you can achieve the site style changes over time, the method is directly in the ASP program <head> and </head> tags add the following code:
<link rel= "stylesheet" type= text/css "href=" <% If Hour (now) <12 then Response.Write "Morning.css" ElseIf hour ( Now) <17 then Response.Write "Day.css ' Else Response.Write" night.css "End if%>"/>
Where morning.css represents the style sheet files that are displayed during the day, and Night.css is the style that is displayed at night, it is only necessary to make separate CSS files.
2.PHP Site Style Changes
If you are using a PHP-structured web site, you can use the following PHP code. Add it to the PHP file header code in the Web site.
When you add code, you need to delete the default style sheet link file, or you may have page dislocation.
3. Static page with JavaScript code
For the site page generated HTML static page, the same can be a JavaScript code to achieve the site style change effect, the use of a very simple method, just add the following code to the site page.
<script type= "Text/javascript" ><!--function Getcss () {datetoday = new Date (); Timenow=datetoday.gettime (); Datetoday.settime (TimeNow); Thehour = Datetoday.gethours (); if (thehour<12) display = "Morning.css"; else if (thehour<17) display = "Day.css";
Many browsers prohibit JavaScript from displaying, so don't forget to set a default CSS style to ensure that users can access the site normally.
The site has a basic framework and content, in fact, has been established, but the next maintenance is a long-term work. In the "New Station Maintenance Trilogy" article series, we will be the site of some common maintenance problems focused on the description, including perfecting the basic functions of the new site, production site map and content replication tips such as novice webmaster most likely to encounter problems.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.