zoukankan      html  css  js  c++  java
  • 网页换肤

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>网页换肤</title>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            body{
                background: url(img/bg1.jpg) no-repeat top left;
            }
            ul{
                list-style: none;
            }
            ul li{
                 80px;
                height: 50px;
                margin: 10px;
                border: 1px solid #222;
                float: left;
            }
            ul li img{
                 80px;
                height: 50px;
                cursor: pointer;
            }
        </style>
        <script type="text/javascript">
            window.onload = function(){
                var imgs = document.getElementsByTagName("img");
                for (var i = 0; i < imgs.length; i++) {
                    imgs[i].onclick = function(){
                        document.body.style.background = "url(" + this.src + ")";
                    }
                };
            }
        </script>
    </head>
    <body>
        <ul>
            <li><img src="img/bg1.jpg"></li>
            <li><img src="img/bg2.jpg"></li>
            <li><img src="img/bg3.jpg"></li>
        </ul>
    </body>
    </html>     
  • 相关阅读:
    windows系统Redis客户端连接远程服务器
    Linux安装JDK1.8示例
    Nexus OrientDB数据库变为只读 storage is switched to 'read only' mode
    在SQL中有时候我们需要查看现在正在SQL Server执行的命令
    注册asp.net 到 iis时出错中的一种的 解决办法
    python 装饰器
    python 类调用实例的方法
    linux 命令大全
    python多态
    python扩展字典的功能
  • 原文地址:https://www.cnblogs.com/mmit/p/11268768.html
Copyright © 2011-2022 走看看