图片切换JS浏览器兼容

sdlanbing 2012-11-25 02:46:22
我在百度上找的图片切换代码,但是只能砸IE上能用,谷歌和火狐却不行,求教哪位大哥帮忙看下。感谢
<div id="black3">
<div class="imgbox" id="photo"><a id=foclnk href="/" target=_blank><img id=focpic style="FILTER: RevealTrans(duration=1;ransition=12); VISIBILITY: visible; POSITION: absolute;" src="<%=rs("imagepath1")%>" /></a></div>
<div id="player">姓名:<%=rs("bname")%><br />
<span style="color:red;">编号:368<%=rs("bianhao")%></span><br />
性别:<%=rs("sex")%><br />
年龄:<%=rs("age")%><br />
祝福语:<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; font-size:13px; line-height:20px"><%=rs("content")%></pre><div style="font-size:16px;color:green;">给 <%=rs("bname")%> 短信投票方式:编辑368<%=rs("bianhao")%>发送到10628787210,<%=rs("bname")%>感谢您的支持!</div></div>
<div id="p2">
<div class="imgbox2" id="tmb0" onmouseover=setfoc(0); onmouseout=playit();><% if rs("imagepath2")<>"" then %>
<a href="/" target=_blank><img name="pto" src="<%=rs("imagepath2")%>" /></a>
<%end if%></div>
<div class="imgbox2" id="tmb1" onmouseover=setfoc(1); onmouseout=playit();><% if rs("imagepath3")<>"" then %>
<a href="/" target=_blank><img name="pto" src="<%=rs("imagepath3")%>" /></a>
<%end if%></div>
<div class="imgbox2" id="tmb2" onmouseover=setfoc(2); onmouseout=playit();><% if rs("imagepath4")<>"" then %>
<a href="/" target=_blank><img name="pto" src="<%=rs("imagepath4")%>" /></a>
<%end if%></div>
<div class="imgbox2" id="tmb3" onmouseover=setfoc(3); onmouseout=playit();><% if rs("imagepath5")<>"" then %>
<a href="/" target=_blank><img name="pto" src="<%=rs("imagepath5")%>" /></a>
<%end if%></div>
</div>
<script language=javascript type=text/javascript>
var picarry = {};
var lnkarry = {};
picarry[0] = "<%=rs("imagepath2")%>";
lnkarry[0] = "/";
picarry[1] = "<%=rs("imagepath3")%>";
lnkarry[1] = "/";
picarry[2] = "<%=rs("imagepath4")%>";
lnkarry[2] = "/";
picarry[3] = "<%=rs("imagepath5")%>";
lnkarry[3] = "/";
</script>
</div>
<SCRIPT type=text/javascript>
var currslid = 0;
function setfoc(id){
document.getElementById("focpic").src = picarry[id];
document.getElementById("foclnk").href = lnkarry[id];
currslid = id;
for(i=0;i<4;i++){
document.getElementById("tmb"+i).className = "imgbox2";
};
document.getElementById("tmb"+id).className ="imgbox2";
focpic.style.visibility = "hidden";
focpic.filters[0].Apply();
if (focpic.style.visibility == "visible") {
focpic.style.visibility = "hidden";
focpic.filters.revealTrans.transition=23;
}
else {
focpic.style.visibility = "visible";
focpic.filters[0].transition=23;
}
focpic.filters[0].Play();
stopit();
}

function playnext(){
if(currslid==3){
currslid = 0;
}
else{
currslid++;
};
setfoc(currslid);
playit();
}
function playit(){
slidint = setTimeout(playnext,4500);
}
function stopit(){
clearTimeout(slidint);
}
window.onload = function(){
playit();
}</SCRIPT>
...全文
36 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧