美文网首页
js根据时间自动更换背景代码

js根据时间自动更换背景代码

作者: f675b1a02698 | 来源:发表于2017-09-13 08:32 被阅读0次

var d = new Date();

//显示当前时间的小时数,测试用的,可以删除document.write( d.getHours() );

var time=d.getHours();

if (time==1){document.getElementById("a").style.backgroundColor="#0066CC";}

if (time==2){document.getElementById("a").style.backgroundColor="#0072E3";}

if (time==3){document.getElementById("a").style.backgroundColor="#0080FF";}

if (time==4){document.getElementById("a").style.backgroundColor="#2894FF";}

if (time==5){document.getElementById("a").style.backgroundColor="#46A3FF";}

if (time==6){document.getElementById("a").style.backgroundColor="#66B3FF";}

if (time==7){document.getElementById("a").style.backgroundColor="#84C1FF";}

if (time==8){document.getElementById("a").style.backgroundColor="#97CBFF";}

if (time==9){document.getElementById("a").style.backgroundColor="#ACD6FF";}

if (time==10){document.getElementById("a").style.backgroundColor="#C4E1FF";}

if (time==11){document.getElementById("a").style.backgroundColor="#D2E9FF";}

if (time==12){document.getElementById("a").style.backgroundColor="#ECF5FF";}

if (time==13){document.getElementById("a").style.backgroundColor="#D2E9FF";}

if (time==14){document.getElementById("a").style.backgroundColor="#C4E1FF";}

if (time==15){document.getElementById("a").style.backgroundColor="#ACD6FF";}

if (time==16){document.getElementById("a").style.backgroundColor="#97CBFF";}

if (time==17){document.getElementById("a").style.backgroundColor="#84C1FF";}

if (time==18){document.getElementById("a").style.backgroundColor="#66B3FF";}

if (time==19){document.getElementById("a").style.backgroundColor="#46A3FF";}

if (time==20){document.getElementById("a").style.backgroundColor="#2894FF";}

if (time==21){document.getElementById("a").style.backgroundColor="#0080FF";}

if (time==22){document.getElementById("a").style.backgroundColor="#0072E3";}

if (time==23){document.getElementById("a").style.backgroundColor="#0066CC";}

alert(time);

相关文章

  • js根据时间自动更换背景代码

    var d = new Date(); //显示当前时间的小时数,测试用的,可以删除document.write(...

  • JS点击(更换背景颜色)

    JS点击更换背景颜色分为四种: 1.单独按钮点击更换 2.下拉菜单更换背景 3.鼠标点击背景更换 4.重复点击按钮更换

  • js创建点击事件 和 js原生复制

    复制 html代码 js代码 自动点击事件实现页面自动跳转 html代码 PS:自动事件可以实现自动跳转,不能实现...

  • 广告弹出效果

    自动关闭的广告 效果: html代码: js代码: 关闭后自动弹出的广告 效果: html代码跟上面是一样的,js...

  • redis操作命令总结

    redis操作命令总结 如果你是用手机再看这篇文章的话,有可能代码块部分会根据手机自动换行等影响体验,你可以更换电...

  • About JSPatch

    OC 代码自动转换成JSPatch补丁代码的网站:OC自动转换JS补丁脚本语言链接

  • JS开发假百度

    效果图: 背景图: CSS代码: HTML代码: JS代码,记得引入JQuery:

  • js对象undefined根据key值取value的一个坑

    js对象undefined根据key值取value的一个坑背景是这样的, 代码中tutorsArr是一个数组,里面...

  • idea 自动生成代码

    根据表结构自动生成dao层代码

  • 更换背景

    ax.stock_img(); import cartopy.io.img_tiles as cimgt http...

网友评论

      本文标题:js根据时间自动更换背景代码

      本文链接:https://www.haomeiwen.com/subject/qlogjxtx.html