收藏的星星,切换效果(jquery)
jq自己再找吧
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <div class="img"> <img src="img/c1.jpg" > </div> </body> </html> <script src="js/jquery.min.js"></script> <script> $(".img").click(function(){ if($('.img img').attr('src')=='img/c1.jpg'){ $('.img img').attr('src','img/c2.jpg'); }else{ $('.img img').attr('src','img/c1.jpg'); } }) </script>