Javascript functions can be placed in a separate js file or in the
Copy codeThe 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)
// Style table name, or you can add a path
Display = "1.css ";
Else
Display = "2.css ";
// (... If you want to add more ...)
Var css = '<';
Css + = 'link rel = "stylesheet" href = '+ display + '\/';
Css + = '> ';
Document. write (css );
}
Apply the HTML file of the style sheet
Copy codeThe Code is as follows:
<Html>
<Head>
<Title> display different prompts at different times </title>
<Script type = "text/javascript" src = "dacss. js"> </script>
</Head>
<Body>
<Script type = "text/javascript">
Window. onload = getCSS ();
</Script>
Js controls different css styles for different time periods
</Body>
</Html>