zoukankan      html  css  js  c++  java
  • 简易相册

    <!DOCTYPE html>
    <html>

    <head>
    <meta charset="UTF-8">
    <title>web相册</title>
    </head>
    <style type="text/css">
    .img_border{
    border: 3px solid #cd853f;
    }
    </style>
    <script type="text/javascript">
    var currentImgIndex=-1;//相当于图片的序号
    function showImg(index){
    if(isNaN(index))return;
    if(index<0||index>2)return;

    currentImgIndex=index;
    var thumbList=document.getElementsByName("thumb");
    var imgCanvas=document.getElementById("showImg");

    switch(index){
    case 0:
    var _img=document.createElement("img");
    imgCanvas.innerHTML=
    "<img src='img/360.png' width='400' height='300'/>";
    thumbList[0].className="img_border";
    thumbList[1].className=thumbList[2].className="";
    break;

    case 1:
    imgCanvas.innerHTML=
    "<img src='img/baidu.png'width='400' height='300' />"
    thumbList[1].className="img_border";
    thumbList[0].className=thumbList[2].className="";
    break;

    case 2:
    imgCanvas.innerHTML=
    "<img src='img/sougou.png' width='400' height='300'/>";
    thumbList[2].className="img_border";
    thumbList[0].className=thumbList[1].className="";
    break;
    default:
    imgCanvas.innerHTML=
    "<img src='' width='400' height='300'/>"
    }

    }

    function nextImg()
    {
    currentImgIndex++;
    if(currentImgIndex>2) currentImgIndex=2;
    showImg(currentImgIndex);
    }
    function preImg(){
    currentImgIndex--;
    if(currentImgIndex<0) currentImgIndex=0;
    showImg(currentImgIndex);
    }
    </script>
    <body>
    <h2>缩略图</h2>
    <table>
    <tr>
    <td><input type="button" value="<"onclick="preImg()"></td>
    <td><img src="img/360.png" width="150" height="75" name="thumb"onclick="showImg(0)"></td>
    <td><img src="img/baidu.png"width="150"height="65" name="thumb"onclick="showImg(1)"></td>
    <td><img src="img/sougou.png"width="150"height="65"name="thumb"onclick="showImg(2)"> </td>
    <td><input type="button"value=">" onclick="nextImg()"></td>
    </tr>
    </table>
    <div id="showImg"class="show_img">
    <img src="" width="400"height="300" />
    </div>
    </body>

    </html>

  • 相关阅读:
    归并排序(Merge Sort)
    AtCoder AGC035D Add and Remove (状压DP)
    AtCoder AGC034D Manhattan Max Matching (费用流)
    AtCoder AGC033F Adding Edges (图论)
    AtCoder AGC031F Walk on Graph (图论、数论)
    AtCoder AGC031E Snuke the Phantom Thief (费用流)
    AtCoder AGC029F Construction of a Tree (二分图匹配)
    AtCoder AGC029E Wandering TKHS
    AtCoder AGC039F Min Product Sum (容斥原理、组合计数、DP)
    AtCoder AGC035E Develop (DP、图论、计数)
  • 原文地址:https://www.cnblogs.com/wxhhts/p/8178820.html
Copyright © 2011-2022 走看看