• 网页换肤


    <!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>     
  • 相关阅读:
    Java中Collection和Collections的区别
    网站
    window.load 和$(document).ready() 、window.load和body onload区别
    『jQuery』.html(),.text()和.val()的使用
    jQuery选择器总结
    ios开发--编码格式
    iOS开发--基于AFNetWorking3.0的图片缓存分析
    iOS开发--沙盒路径与操作文件
    ios开发--第三方整理
    iOS 网络处理注意点
  • 原文地址:https://www.cnblogs.com/mmit/p/11268768.html
Copyright © 2020-2023  润新知