js控制的图片切换总是闪烁(鼠标还未离开切换区,只要轻轻碰一下鼠标,显示的大图来回闪,高手帮帮忙)

JavaScript028

js控制的图片切换总是闪烁(鼠标还未离开切换区,只要轻轻碰一下鼠标,显示的大图来回闪,高手帮帮忙),第1张

把最后的img用div包起来

<div onMouseOver="ShowImage()" onMouseOut="ShowImage()">

<img src="images/index_r3_c9.jpg" width="115" height="115" border="0" >

</div>

image 应该是一个数组 里面 放着要闪烁的 图片路径

如:var image = new Array('10.jpg','20.jpg','30.jpg','40.jpg') 

image.length 统计这个数组有多少个成员

currentimg 是一个从 0 开始的 数值 没闪烁一次 它就 currentimg++当闪烁到最后的时候 它又变为0

image[currentimg] 而 就是从数组里面 去到当前 要闪烁图片的路径

比如 image[1] 取到的 就是 是 10.jpg

你可以做个闪烁的图片,用下面的用文件和JS

<---index.html-->

<div align="center" id="miman">

<table width="760" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><a href="http://www.baidu.com" target="_blank"><img src="baidu.gif" width="801" height="373" border="0"></a></td>

</tr>

</table>

</div>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">

<title>定时关闭的广告代码</title>

<script src="up.js" language="JavaScript"></script>

</head>

<body onLoad="log_start()">

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p>

</p>

</body>

</html>

<----up.js-->

var time_out = 3000

function log_start()

{

window.miman.style.visibility="visible"

window.setTimeout( "real_log_start()", time_out )

return false

}

function real_log_start()

{

window.miman.style.display="none"

}

希望对你有帮助!