欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript每天定時(shí)更換皮膚樣式的方法

 更新時(shí)間:2015年07月01日 12:30:43   作者:不吃皮蛋  
這篇文章主要介紹了JavaScript每天定時(shí)更換皮膚樣式的方法,涉及javascript針對(duì)時(shí)間及css樣式的相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了JavaScript每天定時(shí)更換皮膚樣式的方法。分享給大家供大家參考。具體分析如下:

這段js代碼通過(guò)每天在不同時(shí)段自動(dòng)更換網(wǎng)頁(yè)調(diào)用的樣式表,實(shí)現(xiàn)更換皮膚的功能。

<script type="text/JavaScript">
<!--
function getStylesheet() {
   var currentTime = new Date().getHours();
   if (0 <= currentTime&&currentTime < 5) {
    document.write("<link rel='stylesheet' href='night.css' type='text/css'>");
   }
   if (5 <= currentTime&&currentTime < 11) {
    document.write("<link rel='stylesheet' href='morning.css' type='text/css'>");
   }
   if (11 <= currentTime&&currentTime < 16) {
    document.write("<link rel='stylesheet' href='day.css' type='text/css'>");
   }
   if (16 <= currentTime&&currentTime < 22) {
    document.write("<link rel='stylesheet' href='evening.css' type='text/css'>");
   }
   if (22 <= currentTime&&currentTime <= 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>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論