jb51站长推荐的用js实现的多浏览器支持的图片轮换展示效果ie,firefox 时间:2020-05-12 人气:0 jb51站长推荐的用js实现的多浏览器支持的图片轮换展示效果在ie,firefox和测试一切正常,建议以后大家都要用这样的兼容性比较好的代码 <script language=javascript> </script> <script language=javascript type=text/javascript> "); p$(""); function change(){ if (ver==1){ with($('f_img').filters[0]){ Transition=1; apply(); play(); } } if (firstTime){ firstTime=false;timeOut=_timeOut_/1000;} else{ $('f_img').src=imgUrl[now]; $('f_img').alt=imgAlt[now]; $('f_imgLink').href=imgLink[now]; if (show_text) $('f_text').innerHTML=imgText[now]; for (var i=0;i=imgUrl.length-1)?0:now+1; timeOut=_timeOut_; } theTimer=setTimeout("change()", timeOut); } function b_change(num){ window.clearInterval(theTimer); now=num; firstTime=false; change(); } /https://img.qb5200.com/download-x/draw 渐变line (即css:f_line) function draw_line(){ var div = document.createElement("div"); div.id = 'f_line'; $('f_infoDiv').insertBefore(div,$('f_infoDiv').childNodes.item(0)); } //表现层 start //menu for(var i=0;i=0;i--){ var div_bg = document.createElement("div"); div_bg.id = 'div_bg'+i; div_bg.className='bg'; $('f_buttonDiv').appendChild(div_bg); var a = document.createElement("a"); a.id = 'b'+i; a.className = (i==now+1)?"button_on":"button_off"; a.title=imgAlt[i]; a.innerHTML=i+1; a.href='javascript:b_change('+i+')'; $('div_bg'+i).appendChild(a); var div= document.createElement("div"); $('f_buttonDiv').appendChild(div); } if (show_text) $('f_text').innerHTML = imgText[now]; //表现层 end $('f_img').onmouseover=function(){window.clearInterval(theTimer);} $('f_img').onmouseout=function(){theTimer=setTimeout("change()", timeOut2);} try{ //滤镜版本 new ActiveXObject("DXImageTransform.Microsoft.Fade"); $('f_img').filters[0].play(); ver=1; draw_line(); } catch (e){ver=2;} var theTimer = setTimeout("change()", _timeOut_/1000); //--> </script> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 加载全部内容