HTML window earthquake using javascript

Funny EarthQuake or Shake Effect of html window

With Javascript We can play with our own effects and animation.here we find one simple example of window shake effect.here we use basic window object and its moveby method.we already discussed about settimeout function in previous post.
In this example href attribute of HTML anchor to javascript functions start,stop.when we click link browser call the corresponding functions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html>
<head>
<script>
var timer;
var movelength=10;
function start()
{
parent.moveBy(0,movelength)
parent.moveBy(0,-movelength)
parent.moveBy(movelength,0)
parent.moveBy(-movelength,0)
timer=setTimeout("start()",100)
}
function stop()
{
clearTimeout(timer)
}
</script>
</head>
<body>
<a href="javascript:start();">start</a>
<a href="javascript:stop();">stop</a>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">