<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>javascript layer Jitter Effect </title>
<style type= "Text/css" >
#body {text-align:center;}
#test {width:200px;position:absolute;margin:10px auto;height:100px;border:2px dotted red;text-align:center}
</style>
<body>
<div style= "margin:10px 200px" >
<div>
<input type= "button" value= "~ point here Let me shake it ~" onclick= "Nn.start ()"/></div>
<div>
<input type= "button" value= "Shake dizzy, I don't shake!" "Onclick=" Nn.stop () "/></div>
<div id= "Test" >
<br>
</div>
</div>
<p> </p>
<p> </p>
</body>
<script type= "Text/javascript" >
var M=document.getelementbyid ("Test");
function Skclass (obj,rate,speed) {
var ol=obj.offsetleft;
var ot=obj.offsettop;
This.stop=null;
This.otime=null;
var om=this;
This.start=function () {
if (parseint (obj.style.left) ==ol-2) {
obj.style.top=ot+2+ "px";
SetTimeout (function () {obj.style.left=ol+2+ "px"},rate)
}
else{
obj.style.top=ot-2+ "px";
SetTimeout (function () {obj.style.left=ol-2+ "px"},rate)
}
This.otime=settimeout (function () {Om.start ()},speed);
}
This.stop=function () {
Cleartimeout (This.otime);
}
}
var nn=new skclass (m,20,70);
</script>
<div>http://www.999jiujiu.com/</div>
</body>
JS layer jitter effect, similar to QQ chat window jitter