zoukankan      html  css  js  c++  java
  • 简单的点击切换图

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>练习</title>
    <style type="text/css">

    *{
    margin: 0;
    padding: 0;
    margin: 0 auto;
    }

    .cas{
    margin-top: 100px;
    400px;
    height: 430px;
    background-color: skyblue;

    }

    #cssa{
    160px;
    height: 360px;

    /*margin-top: -100px;*/
    background:url(images/2.jpg) top center;

    }
    .shubai{
    cursor: pointer;
    /*margin-top: 100px;*/
    }
    /*.shubai ul{
    float: left;
    list-style: none;
    }*/
    .shubai ul .casa1{
    float: left;
    60px;
    height: 20px;
    }
    .shubai ul .casa2{
    float: left;
    60px;
    height: 20px;
    }
    .shubai ul .casa3{
    float: left;
    60px;
    height: 20px;
    }
    .shubai ul .casa4{
    float: left;
    60px;
    height: 20px;
    }
    .shubai ul .casa5{
    float: left;
    60px;
    height: 20px;
    }

    .shubai li{
    40px;
    height: 20px;
    margin-top: 390px;

    list-style: none;

    /*line-height: 18px;*/
    background-color: #3E3E3E;
    float: left;
    text-align: center;
    color: #FFFFFF;
    /*border-radius: 50%;*/
    /*margin: 0 40px 0 60px;*/
    /*cursor: pointer;*/
    margin-left: 16px;
    }

    </style>
    </head>
    <body>

    <div class = "cas">

    <div class = "shubai">
    <ul class = "kaishi">
    <li class = "casa1" id = "pxc1">picture1</li>
    <li class = "casa2" id = "pxc2">picture2</li>
    <li class = "casa3" id = "pxc3">picture3</li>
    <li class = "casa4" id = "pxc4">picture4</li>
    <li class = "casa5" id = "pxc5">picture5</li>
    </ul>

    </div>
    <div id ="cssa"></div>
    </div>

    <script type="text/javascript">

    var pxc = document.getElementById("cssa");

    var p1 = document.getElementById("pxc1");
    var p2 = document.getElementById("pxc2");
    var p3 = document.getElementById("pxc3");
    var p4 = document.getElementById("pxc4");
    var p5 = document.getElementById("pxc5");

    pxc1.onclick = function(){
    pxc.style.backgroundImage = "url(images/1.jpg)";

    }
    pxc2.onclick = function(){
    pxc.style.backgroundImage = "url(images/2.jpg)";
    }
    pxc3.onclick = function(){
    pxc.style.backgroundImage = "url(images/3.jpg)";
    }
    pxc4.onclick = function(){
    pxc.style.backgroundImage = "url(images/4.jpg)";
    }
    pxc5.onclick = function(){
    pxc.style.backgroundImage = "url(images/5.gif)";
    }

    </script>

    </body>
    </html>

  • 相关阅读:
    自己写的一个后台模板
    php计算登陆时间差
    友盟推送,php简单代码
    rolling_curl curl批量采集函数留份
    PHP socket服务框架
    JS 画饼图,折线图
    jquery 日期插件
    JS 获取当前页面url,及锚点
    PHP 读取文件,返回二进制流
    各个数据库DataSource配置文件
  • 原文地址:https://www.cnblogs.com/xiaohaishuangyu/p/6009944.html
Copyright © 2011-2022 走看看