You Are Here: Home »   Code Tuesday January 6th 2009

Code Library - js

Shake Browser - (1167 views)


Place the following anywhere between <head> and </head> tags

  <script language="JavaScript1.2">

<!-- Begin
function shake(n) {
if (self.moveBy) {
for (i = 15; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
         }
      }
   }
}
// End -->

</script>

Then put the following where you want the button displayed

  <input type=button value="Click Here To Shake" onClick=shake(20) name="button22">

NOTE: This only works in IE