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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script src="../jquery-1.11.2.min.js"></script>
    </head>
    
    <body>
    <!--<banner>-->
    <banner>
    <div>
        <img class="img_1" src="image/banner01.jpg"  style="1318px; height:375px;"/>
    
       
        
    </div>
    </banner>
    </body>
    <script>
    $(function(){
        var i=1;
        function huan()
        {    if(i==5){
            i=1;
            var src="image/banner0"+i+".jpg";
            $(".img_1").attr("src",src);
            i++;
            }
            else
            {
            var src="image/banner0"+i+".jpg";
            $(".img_1").attr("src",src);
            i++;
            }
            
        }
        function zuo()
        {    if(i==1){
            i=4;
            var src="image/banner0"+i+".jpg";
            $(".img_1").attr("src",src);
            i--;
            }
            else
            {
            var src="image/banner0"+i+".jpg";
            $(".img_1").attr("src",src);
            i--;
            }
            
        }
        
        window.setInterval(huan,2000);
        
        $(".arrow-right").click(function()
        
        {
            huan();
            });
        $(".arrow-left").click(function()
        
        {
            zuo();
            });
        
        })
        
    </script>
    
    
    </html>
  • 相关阅读:
    Python(条件判断和循环)
    大端还是小端
    c语言程序设计 字符串拷贝拷贝演变与初衷
    内存 匹配串
    多态 C2
    多态 C1
    判断是否存在不合法字符(C++)
    va_start、vsprintf、va_end
    java中instanceof用法
    c++ vector相关
  • 原文地址:https://www.cnblogs.com/Yue0327/p/5493281.html
Copyright © 2011-2022 走看看