JS layer jitter effect, similar to QQ chat window jitter, js window
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> JavaScript layer jitter </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>
</Head>
<Body>
<Div style = "margin: 10px 200px">
<Div>
<Input type = "button" value = "~ Click here to shake me up ~ "Onclick =" nn. start () "/> </div>
<Div>
<Input type = "button" value = "shake off. I'm not shaking! "Onclick =" nn. stop () "/> </div>
<Div id = "test">
<Br>
</div>
</Div>
<P> </p>
<P> </p>
</Body>
</Html>
<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> <A href = "http://www.999jiujiu.com/"> http://www.999jiujiu.com/</A> </div>
</Body>
</Html>