夜间模式的开启与关闭,父模板的制作

复制代码
复制代码
<!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <title>img</title> <link rel="stylesheet" type="text/css" href="../static/css/i.css"> </head> <body> <input type="text"> <button>查找</button> <div class="recommend"> <div class="img"> <a href="http://www.gzcc.cn"><img src="http://img.zcool.cn/community/013bea58db839da801219c777e2827.gif"></a> <div class="desc"><a href="http://www.gzcc.cn">校园风光</a></div> </div> <div class="img"> <a href="http://www.gzcc.cn"><img src="http://img.zcool.cn/community/013e3a58db839da801219c7714f34c.gif"></a> <div class="desc"><a href="http://www.gzcc.cn">校友风采</a></div> </div> <div class="img"> <a href="http://www.gzcc.cn"><img src="http://img.zcool.cn/community/0102fd58db839ea801219c774b8624.gif"></a> <div class="desc"><a href="http://www.gzcc.cn">学校文化</a></div> </div> <div class="img"> <a href="http://www.gzcc.cn"><img src="http://img.zcool.cn/community/01701158db839ea801219c77232e16.gif"></a> <div class="desc"><a href="http://www.gzcc.cn">学生风采</a></div> </div> </div> <div class="clearfloat"> <img src="http://img.zcool.cn/community/01ec0058db83a8a801219c77daff8a.gif" > </div> </body> </html>
复制代码

 

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
27
28
29
30
夜间模式<br><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>夜晚模式</title>
    <script>
        function mySwich() {
            var oBody = document.getElementById("myBody");
            var oOnoff = document.getElementById("myOnoff");
            if (oOnoff.src.match("1509")){
                oOnoff.src="https://timgsa.baidu.com/timg?image&quality=80&size=b10000_10000&sec=150";
                oBody.style.background="black";
                oBody.style.color="green";
  
            }else {
                oOnoff.src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509";
                oBody.style.background="white";
                oBody.style.color="pink";
            }
        }
    </script>
</head>
<body id="myBody">
  
<img id="myOnoff" onclick="mySwich()" src="https://timgsa.baidu.com/timg?image&quality=80&size=b10000_10000&sec=150" width="60px">
<script>
    document.write(Date())
</script>
</body>
</html>

  

复制代码
复制代码
复制代码
img {
    width: 300px;
}

div .img {
    border: 1px solid #ccc;
    width: 150px;
    float: left;
    margin: 5px;

}
div.img img {
    width: 100%;
    height: auto;
}


div.desc {
    text-align: center;
    padding: 5px;

}

div.img:hover {
    border: 1px solid #000000;
}

div.clearfloat {
    clear: both;
}
复制代码
posted @   031庄园  阅读(174)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示