English
<!-- http://www.downcodes.com --> <!-- bbs http://bbs.downcodes.com --> <!--To achieve this effect, two steps are required. The first step is: Add the following code to the <head> area --> <script type="text/javascript"> var x=0,y=0,w=200,h=100, dx=5,dy=5, interval=100 var win=null; var intervalID; function startIt() { win=window.open('javascript:"http://www.downcodes.com"',"","width="+w+",height="+ h) win.moveTo(x,y) intervalID = window.setInterval("bounce()",interval) } var running=false; var close=false; function bounce() { running=true if (win.closed) { clearInterval(intervalID) running=false return } if ((x+dx>(500-w)) || (x+dx<0))dx=-dx if ((y+dy>(500-h)) | | (y+dy<0))dx=-dy x+=dx y+=dy win.moveTo(x,y) if (close) { win.close() clearInterval(intervalID) } } function closeWin() { if ( running) close=true } </script> <!--Step 2: Add the following code to the <body> area--> <p><a href="#" onMousedown='startIt()'>Display Window</a></p> <p> <a href="#" onMousedown='closeWin()'>Close window</a></p>