117、鼠标悬停颜色

117、鼠标悬停颜色

脚本说明:

把如下代码加入<body>区域中

<script language="javascript">

function flasher(){

 

var swap = new Array(3)

swap[0]="yellow"

swap[1]="red"

swap[2]="blue"

swap[3]="green"

swap[4]="skyblue"

swap[5]="salmon"

swap[6]="purple"

swap[7]="pink"

 

 

var i =Math.floor(Math.random() * 6) + 1

 

 

document.flash.button1.style.backgroundColor=swap[i]

document.flash.button1.style.color="yellow"

 

 

Stop=setTimeout("flasher()",50)

 

}

function stopFlash(){

clearTimeout(Stop)

}

 

</script>

<form name="flash">

<input type="button" name="button1" value="鼠标悬停颜色" onMouseOver="flasher()" onMouseOut="stopFlash()">

</form>

 

Write a comment

Comments: 0