请JS高手帮忙解决问题,一个焦点图代码在Google浏览器下不能正常显示

JavaScript030

请JS高手帮忙解决问题,一个焦点图代码在Google浏览器下不能正常显示,第1张

ff,gg不显示是因为不支持filters滤镜,所以改为透明载入的方式实现。

页面刚载入的时候也没有轮播,鼠标over的时候也没有停止轮播,以上错误我都已改正。

我是豪情,豪情就是我。

var picarry = []

var lnkarry = []

var ttlarry = []

picarry[0] = "images/01.jpg"

lnkarry[0] = "#"

ttlarry[0] = "# 标题1"

picarry[1] = "images/02.jpg"

lnkarry[1] = "#"

ttlarry[1] = "# 标题2"

picarry[2] = "images/03.jpg"

lnkarry[2] = "#"

ttlarry[2] = "# 标题3"

picarry[3] = "images/04.jpg"

lnkarry[3] = "#"

ttlarry[3] = "# 标题4"

var currslid = 0

var slidint

/**

* 设置透明度

* @param {Object} elem

* @param {Object} level (0-100)

*/

function setOpacity(elem, level){

if(elem.filters){ //如果是IE

elem.style.filter = 'alpha(opacity=' + level + ')'

elem.style.zoom = 1

} else { //否则是W3C

elem.style.opacity = level / 100

}

}

/**

* 透明度渐显 From: http://mrthink.net/js-fadein-fadeout-fadeto/

* @param {Object} elem

* @param {Number} speed 淡入速度,正整数(可选)

* @param {Number} opacity 淡入到指定的透明度,0~100(可选)

*/

function fadeInThink(elem, speed, opacity){

speed = speed || 20

opacity = opacity || 100

//show(elem)

setOpacity(elem, 0)

//初始化透明度变化值为0

var val = 0

//循环将透明值以5递增,即淡入效果

(function(){

setOpacity(elem, val)

val += 5

if (val <= opacity) {

setTimeout(arguments.callee, speed)

}

})()

}

function setfoc(id) {

stopit()

var focpic = document.getElementById("focpic")

focpic.src = picarry[id]

document.getElementById("foclnk").href = lnkarry[id]

document.getElementById("fttltxt").innerHTML = "<a href=\"" + lnkarry[id] + "\" target=_blank>" + ttlarry[id] + "</a>"

//currslid = id

for (i = 0i <4i++) {

document.getElementById("tmb" + i).className = "thubpic"

}

document.getElementById("tmb" + id).className = "thubpiccur"

if(focpic.filters){

focpic.style.visibility = "hidden"

focpic.filters[0].Apply()

if (focpic.style.visibility == "visible") {

focpic.style.visibility = "hidden"

focpic.filters.revealTrans.transition = 12

}

else {

focpic.style.visibility = "visible"

focpic.filters[0].transition = 12

}

focpic.filters[0].Play()

} else {

fadeInThink(focpic)

}

}

function playnext() {

if (currslid == 3) {

currslid = 0

} else {

currslid++

}

setfoc(currslid)

playit()

}

function playit() {

slidint = setTimeout(playnext,2000)

}

function stopit() {

clearTimeout(slidint)

}

playit()

<div style="background-color: silverpadding:60pxwidth:130px" onclick="this.style.backgroundColor='green'" onmousemove="this.style.backgroundColor='yellow'" onmouseout="this.style.backgroundColor='silver'" >520</div>