///pc/img/blank.gif" width="12" height="8">当前位置:///default.htm" class="under">亿度网络 -> ///pc/index.htm" class="under">网页制作教程 -> JavaScript实例
///pc/homepage/javascript/sample/img/bule.gif" width="207" height="13"> ///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1"> ///pc/homepage/javascript/sample/img/js.gif" width="186" height="20"> ///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1">
///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1"> ///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1">
    地 震 效 果 ///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1">  
    ///pc/homepage/javascript/sample/img/bule1.gif" width="28" height="49">  
效 果 演 示 ///pc/homepage/javascript/sample/img/bule2.gif" width="11" height="18">

 

 

   
 
源代码如下 ///pc/homepage/javascript/sample/img/bule2.gif" width="11" height="18">



这段程序放在<head>与</head>之间

这段程序放在<body>与</body>之间

   
源程序讲解: ///pc/homepage/javascript/sample/img/bule2.gif" width="11" height="18">
  ///pc/homepage/javascript/sample/img/bule1.gif" width="28" height="49">  

function shake(n)
定义一个函数,名为shake,此例中参数设为2,你可以改改试试,很有趣呦!
{ if (self.moveBy)
如果存在当前窗口,执行以下循环。
{ for (i = 10; i > 0; i--)
i的初值为10,当i大于0时,i=i-1。
{ for (j = n; j > 0; j--)
j的初值为2,当j大于0时,j=j-1。
{ self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0); } } } }
窗口分别向下,左,上,右移动i个像素,产生震动的效果。


  ///pc/homepage/javascript/sample/img/blank.gif" width="1" height="1">  
 

 

网页制作 网页设计 网站建设 网站设计 网站制作 做网站 做网页