Home > Web Front-end > JS Tutorial > body text

js control different time periods to display different css style example code_javascript skills

WBOY
Release: 2016-05-16 17:17:49
Original
871 people have browsed it

js function can be placed in a separate js file or within the tag of the current page

Copy code The code is as follows:

function getCSS()
{
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour<12)
display = "1.css";
else if (thehour>12)
else 🎜>           display = "2.css";
                                                                                                                                                                                                                                 'link rel="stylesheet" href=' display ' /';
css ='>';
document.write(css);
}



HTML file to which this style sheet is applied


Copy code

The code is as follows:Display different prompt information at different times



js controls different time periods to display different css styles



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template