网上看到下面这段代码的,让我想起了MSN的闪屏振动。
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< title > 从天而降的浏览器 </ title >
< script >
<!--
function drop(n) {
if (self.moveBy){
self.moveBy ( 0 , - 900 );
for (i = n; i > 0 ; i -- ){
self.moveBy( 0 , 3 );
}
for (j = 8 ; j > 0 ; j -- ){
self.moveBy( 0 ,j);
self.moveBy(j, 0 );
self.moveBy( 0 , - j);
self.moveBy( - j, 0 );
}
}
}
-->
</ script >
</ head >
< body onLoad ="drop(300)" ></ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< title > 从天而降的浏览器 </ title >
< script >
<!--
function drop(n) {
if (self.moveBy){
self.moveBy ( 0 , - 900 );
for (i = n; i > 0 ; i -- ){
self.moveBy( 0 , 3 );
}
for (j = 8 ; j > 0 ; j -- ){
self.moveBy( 0 ,j);
self.moveBy(j, 0 );
self.moveBy( 0 , - j);
self.moveBy( - j, 0 );
}
}
}
-->
</ script >
</ head >
< body onLoad ="drop(300)" ></ body >
</ html >
就写了个类似与MSN的闪屏振动效果的代码
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< title > 闪动 </ title >
< script >
function flicker(){
for (i = 6 ;i > 0 ;i -- ){
if (self.moveBy){
self.moveBy( 0 , 6 );
self.moveBy( 6 , 0 );
self.moveBy( 0 , - 6 );
self.moveBy( - 6 , 0 );
}
}
}
</ script >
</ head >
< body >
< center >< input type ="button" value ="闪动" onclick ="flicker()" ></ center >
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< title > 闪动 </ title >
< script >
function flicker(){
for (i = 6 ;i > 0 ;i -- ){
if (self.moveBy){
self.moveBy( 0 , 6 );
self.moveBy( 6 , 0 );
self.moveBy( 0 , - 6 );
self.moveBy( - 6 , 0 );
}
}
}
</ script >
</ head >
< body >
< center >< input type ="button" value ="闪动" onclick ="flicker()" ></ center >
</ body >
</ html >
PS:下面这段代码在IE6中打开会报错:
<style>*{position:relative}</style><table><input></table>