How to change the skin style on a regular basis in JavaScript every day
This article describes how to regularly change the skin style of JavaScript every day. Share it with you for your reference. The specific analysis is as follows:
This js Code automatically replaces the style sheet called by the web page at different times every day to achieve skin replacement.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<Script type = "text/JavaScript"> <! -- Function getStylesheet (){ Var currentTime = new Date (). getHours (); If (0 <= currentTime & effecttime <5 ){ Document. write ("<link rel = 'stylesheet 'href}'night.css 'type = 'text/css'> "); } If (5 <= currentTime & effecttime <11 ){ Document. write ("<link rel = 'stylesheet 'href}'morning.css' type = 'text/css '> "); } If (11 <= currentTime & effecttime <16 ){ Document. write ("<link rel = 'stylesheet 'href+'day.css' type = 'text/css '> "); } If (16 <= currentTime & hour tTime <22 ){ Document. write ("<link rel = 'stylesheet 'href}'evening.css' type = 'text/css '> "); } If (22 <= currentTime & hour tTime <= 24 ){ Document. write ("<link rel = 'stylesheet 'href}'night.css 'type = 'text/css'> "); } } GetStylesheet (); --> </Script> <Noscript> <Link href = "main.css" rel = "stylesheet" type = "text/css"> </Noscript> |
I hope this article will help you design javascript programs.