JS Analog QQ window jitter effect _javascript skills

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content= "Text/html; Charset=utf-8 "/> <style type=" Text/css "> #body {text-align:center;} #test {width:119px;position:absolute;margin:10px auto;height:114px;background:url (/images/logo.gif); border:2px Dotted red;} </style> <script type= "Text/javascript" ></script> </pead> <body> <di V > <div><input type= "button" value= "~ ~ ~ Let me Shake It ~ ~" onclick= "Nn.start ()"/></div> < Div><input type= "button" value= "Don't tremble." onclick= "Nn.stop ()"/></div> <div id= "test" ></d iv> </div> </body> </ptml> <script type= "Text/javascript" > var M=document.getel Ementbyid ("test"); function Skclass (obJ,rate,speed) {var ol=obj.offsetleft; var ot=obj.offsettop; This.stop=null; This.otime=null; this.state=0; var om=this; This.start=function () {if (this.state==0) {Ostart (); this.state=1; Else{alert ("So you can't bear it?") ')} ' var ostart=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=o t-2+ "px"; settimeout (function () {obj.style.left=ol-2+ "px"},rate)} om.otime=settimeout (function () {Ostart ()},spe ED); } this.stop=function () {cleartimeout (om.otime); this.state=0; } var nn=new skclass (m,20,50); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.