var number = 3//总图片数量
var num = number-1
var speed = 3000//间隔时间
function amouseover(){
ismouseover = true
}
function amouseout(){
ismouseover = false
}
.
.
.
function imgSwitch(){
if(!ismouseover){
var imgNow = document.getElementById("switch")
var iNow = Math.floor(Math.random()*num)
imgNow.src = imgDyn[iNow][0]
imgNow.parentNode.href = imgDyn[iNow][1]
imgDyn.splice(iNow,1)
if(num>0){
num = num-1
}else{
num = number -1
imgInit()
}
}
setTimeout(imgSwitch,speed)
}
.
.
.
<a onmouseover='amouseover()' onmouseout='amouseout' href="#" target="_blank"><img id="switch" src="" width="100%"></a>
<divid="s">Show</div>
<div
id="h"
style="display:none">Hidden</div>
当鼠标进入
id
为
s
的
Div
时
显示下面本来隐藏的
Div。
当鼠标离开时
隐藏
<script>
var
show
=
document.getElementById('s')
var
hidden
=
document.getElementById('h')
show.onmouseover
=
function
()
{
hidden.style.display
=
"block"
}
show.onmouseleave
=
function
()
{
hidden.style.display
=
"none"
}
</script>