夺命雷公狗jquery---51-each遍历图片

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="js/jquery.js"></script>
        <script>
            $(function(){
                $('#btnok').bind('click',function(){
                     $('img').each(function(i,item){
                         $(item).attr('src','images/00'+(i+1)+'.jpg');
                     });
                });
            });
        </script>
    </head>
    <body>
        <input type="button" id="btnok" value="each" />
        <hr />
        <img  width="100" />
        <img width="100" />
        <img width="100" />
        <img width="100" />
    </body>
</html>

 

posted @ 2015-10-30 05:31  夺命雷公狗  阅读(273)  评论(0编辑  收藏  举报