Este artigo compartilhou o código detalhado da imagem JS que desaparece e a troca para sua referência. O conteúdo específico é o seguinte
<! Doctype html> <html> <head> <meta charset = "utf-8"> <title> </title> <style type = "text/css"> *{preenchimento: 0; margin: 0;} ul {Overflow: hidden;} li {list-style: nenhum; left;line-height: 30px;text-align: center;} img{width:306px;opacity: 0;} .active{background:yellow} </style> </head> <body> <ul> <li>Wang Baoqiang</li> <li>Ma Rong</li> <li>Song Ji</li> </ul> <img src=""/> </body> <script src = "public.js"> </script> <script type = "text/javascript"> var oli = document.getElementsByTagName ("li"); var oimg = document.getElementsByTagName ("img") [0]; var arr = ['img/wbb.jpg', 'img/wlp.jpg', 'img/qs.jpg'] var time = null; var time1 = nulo; for (i = 0; i <oli.length; i ++) {oli [i] .index = i; oli [i] .OnClick = function () {for (i = 0; i <oli.length; i ++) {oli [i] .className = ""; } this.className = "Active"; oimg.src = arr [this.index]; var num = 0; var step = 2; ClearInterval (tempo); ClearInterval (TIME1); time = setInterval (function () {num+= step; if (num> = 200) {num = 200; clearInterval (tempo);} oimg.style.opacity = num/200;}, 20)}} </script> </html>O exposto acima é todo o conteúdo deste artigo. Espero que seja útil para o aprendizado de todos e espero que todos apoiem mais o wulin.com.