Search - Articles - Dev Forums - Favorites - Member Login
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009


Dev Articles
Search Directory
ESET
ASP.NET
VB.Net
C-Sharp
SQL Server
 


 Microsoft®
 MSDN Links
Communities
ASP.NET Home Page
Downloads
Library
Subscriptions
GotDotNet
Communities Hub

More Partners >>

Shake the browser window using JavaScript

Author: DevASP
Download Source Code : 555_ShakeBrowserWindow.zip

This article is about how you can shake the window of the user. This example is very much related to functionality in msn messenger. In msn messenger during chat when you BUZZ in the window.

  • Steps you will do. 
  • Start visual studio and create a new web application. 
  • Open the HTML design of your page and before closing the head tag add the following JavaScript function.

 

<script  language="JavaScript1.2">

 

function shake(n) {

if (parent.moveBy) {

for (i = 10; i > 0; i--) {

for (j = n; j > 0; j--) {

parent.moveBy(0,i);

parent.moveBy(i,0);

parent.moveBy(0,-i);

parent.moveBy(-i,0);

         }

      }

   }

}

</script>

 

 

Now add the following HTML code which will design your web page and call the above JavaScript function to shake the window.

 

<body MS_POSITIONING="GridLayout" bgcolor="#009999">

<center>

<form id="Form1" method="post" runat="server">

<input type="button" onClick="shake(2)" value="Shake Screen">

<H4>Dont forget to visit www.devasp.com</H4>

<a href="http://www.devasp.com">Devasp Team</a>

</form>

</center>

</ form>

</body>

 

Note that the value pass as parameter in the call of JavaScript function is used as duration of shaking the window, larger value means window will be shake for a long time.

 

Run you application and click the button to shake the window.

Article Comments
Good Code

Posted on 12/13/2006 11:30:58 PM by rajendra

I was just lookign for a way to make this work exactly like you have it. Thank you.

Posted on 5/30/2007 9:24:18 PM by Joshua Pelkala

I was just lookign for a way to make this work exactly like you have it. Thank you.

Posted on 5/30/2007 9:24:28 PM by Joshua Pelkala

Hai Friends

I done one Web Application using ASP.NET. I was uploaded

It is run on IE well.

and then It is run also other Browser but change the Alignment

so can u help me.......

Posted on 3/19/2008 9:33:32 AM by kanagarajum

Excellent SITE. I will refer people to your ITEMS. Effective use of Wordpress had some exceptional.
Cheers

Posted on 11/22/2008 1:04:19 PM by cornice

Thanks for this article, it's great. So great that we've made it 'sticky' on The Webmaster Forums. Now we don't have to repeat ourselves, just send people to this article!Excellent SITE. I will refer people to your ITEMS. Effective use of Wordpress had some exceptional.
Cheers

Posted on 11/29/2008 8:27:42 AM by strony internetowe wroclaw

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Change scrollbar color randomly Using JavaScript

Disclaimer - Privacy
© 2002-2008 DevASP.net