蛙 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>
蛙 25-5-2013 12:19
複製上列語法
<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<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>
<img src="http://bunbun000.com/image/04.gif" class="shakeimage" onMouseOver="init(this);rattleimage()" onMouseOut="stoprattle(this)">
</center>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>
<br>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>