#1 接觸圖片時震動 - 蛙 (Administrator) 發表於 12-5-2012 10:41
<CENTER><IMG class=shakeimage onmouseover=init(this);rattleimage() onmouseout=stoprattle(this) src="http://bunbun000.com/image/04.gif"> </CENTER><CENTER> </CENTER>
<CENTER> </CENTER>
<STYLE>
<!--
.shakeimage{position:relative}
-->
</STYLE>
<SCRIPT language=JavaScript>
<!--
var rector=5
var stopit=0
var a=1
function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}
-->
</SCRIPT>
<CENTER> </CENTER>
<DIV align=left><BR><FONT color=blue><style><BR><!--<BR>.shakeimage{position:relative}<BR>--><BR></style><BR><script language="JavaScript"><BR><!--<BR>var rector=5<BR>var stopit=0<BR>var a=1<BR>function init(which){<BR>stopit=0<BR>shake=which<BR>shake.style.left=0<BR>shake.style.top=0<BR>}<BR>function rattleimage(){<BR>if ((!document.all&&!document.getElementById)||stopit==1)<BR>return<BR>if (a==1){<BR>shake.style.top=parseInt(shake.style.top)+rector<BR>}<BR>else if (a==2){<BR>shake.style.left=parseInt(shake.style.left)+rector<BR>}<BR>else if (a==3){<BR>shake.style.top=parseInt(shake.style.top)-rector<BR>}<BR>else{<BR>shake.style.left=parseInt(shake.style.left)-rector<BR>}<BR>if (a<4)<BR>a++<BR>else<BR>a=1<BR>setTimeout("rattleimage()",50)<BR>}<BR>function stoprattle(which){<BR>stopit=1<BR>which.style.left=0<BR>which.style.top=0<BR>}<BR>--><BR></script><BR><center><BR><img src="圖檔位置" class="shakeimage" onMouseOver="init(this);rattleimage()" onMouseOut="stoprattle(this)"><BR></center></FONT></DIV>