1. <div>
    2. <style type="text/css">
    3. .tab_wrap {
    4. position: relative;
    5. height: 1.8rem;
    6. }
    7. .tab_content {
    8. position: absolute;
    9. top: 0;
    10. left: 0;
    11. }
    12. .tab_content,
    13. .tab_content a {
    14. display: block;
    15. width: 7.41rem;
    16. margin-left: 0.03rem;
    17. height: 2.2rem;
    18. overflow: hidden;
    19. }
    20. .tab_content.tab_img {
    21. z-index: 1;
    22. margin-top: 0.25rem;
    23. }
    24. .tab_content.tab_bg {
    25. z-index: 2;
    26. }
    27. .tab_content.tab_a {
    28. z-index: 3;
    29. }
    30. </style>
    31. <div class="tab_wrap">
    32. <div class="tab_content tab_img" id="tabe">
    33. <!-- 第一张图片链接 -->
    34. <img src="https://gfs9.gomein.net.cn/wireless/T1.x_kBbxT1RCvBVdK_1085_200.jpg" id="img">
    35. </div>
    36. <div class="tab_content tab_a" id="tabe">
    37. <!-- 第一张图片对应的跳转链接 -->
    38. <a href="https://game.m.gome.com.cn/happyChick.html?gameCollectId=145001&amp;gameItem=happyChick&amp;gameId=145007"
    39. id="a"></a>
    40. </div>
    41. <div class="tab_content tab_bg">
    42. <!-- 框图片的链接 -->
    43. <img src="https://gfs8.gomein.net.cn/wireless/T1KcCABKLv1RCvBVdK_1125_276.png" alt="">
    44. </div>
    45. </div>
    46. <script>
    47. /*
    48. img_src 里面存放banner图片链接,每个图之间用英文逗号隔开。
    49. img_a 里面存放图片跳转链接,顺序要与图片对上,每个图之间用英文逗号隔开。
    50. */
    51. var img_src = [ "https://gfs8.gomein.net.cn/wireless/T14g_kBK_v1RCvBzVdK_1219_200.png",
    52. "https://gfs9.gomein.net.cn/wireless/T1.x_kBbxT1RCvBVdK_1085_200.jpg",
    53. "https://gfs6.gomein.net.cn/wireless/T1yKKABs_T1RCvBVdK_1085_200.jpg",
    54. "https://gfs6.gomein.net.cn/wireless/T1KsLkBC_v1RCvBVdK_1125_200.jpg"];
    55. var img_a = [ "https://prom.m.gome.com.cn/html/prodhtml/topics/202111/3/channeleMbFrXfIkmt.html",
    56. "https://game.m.gome.com.cn/happyChick.html?gameCollectId=145001&gameItem=happyChick&gameId=145007",
    57. "https://prom.m.gome.com.cn/gcms/MobsaleymeflHt8vg7.html",
    58. "https://prom.m.gome.com.cn/html/prodhtml/topics/202203/1/channel3dXyO66u9xm.html"];
    59. var index = 0;
    60. function qiehuan() {
    61. document.getElementById("img").src = img_src[index];
    62. document.getElementById("a").href = img_a[index];
    63. index++;
    64. /*
    65. index>x; x的值为banner图片数量-1
    66. */
    67. if (index > 3) {
    68. index = 0;
    69. }
    70. }
    71. setInterval('qiehuan()', 5000);
    72. </script>
    73. </div>