Java教程

淘宝小星星评价

本文主要是介绍淘宝小星星评价,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    *{
      border: 0;
      margin: 0;
      ">#f6f6f6;
    }
    img{
      float: left;
    }
  </style>
</head>
<body>
    <img src="images/00.png" alt="">
    <img src="images/00.png" alt="">
    <img src="images/00.png" alt="">
    <img src="images/00.png" alt="">
    <img src="images/00.png" alt="">
<script>
    var imgs = document.images;
    for (var i = 0; i < imgs.length; i++) {
        imgs[i].a = i;
        imgs[i].onmouseover = function () {
            // alert(123)
            for (var j = 0; j <= this.a; j++) {
                // alert(123);
                imgs[j].src = imgs[j].src.replace('00', '01')
            for(var k=imgs.length-1; k<=this.a+2; k++){
                imgs[j].src = imgs[j].src.replace('01','02')
            }
            for(var b=imgs.length+1;b<=this.a+2 ;b++ ){
                imgs[j].src = imgs[j].src.replace('02','03')
            }
            }
        }
    }
</script>

</body>
</html>
这篇关于淘宝小星星评价的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!