欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于javascript實(shí)現(xiàn)窗口抖動(dòng)效果

 更新時(shí)間:2016年01月03日 13:21:42   作者:愚蠢的神  
這篇文章主要介紹了基于javascript實(shí)現(xiàn)窗口抖動(dòng)效果,需要的朋友可以參考下

本文實(shí)例講解了基于javascript實(shí)現(xiàn)窗口抖動(dòng)效果的詳細(xì)代碼,分享給大家供大家參考,具體內(nèi)容如下

效果圖:

鼠標(biāo)點(diǎn)擊,窗口實(shí)現(xiàn)抖動(dòng)。

具體代碼:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312"/>
<title>窗口登陸效果</title>
<style type="text/css">
#win
{
 position:relative;
 width:100px;
 height:100px;
 background-color:#666;
}
</style>
<script type="text/javascript"> 
var a=['top','left'];
var b=0; 
var u;
function fudu()
{ 
 win.style[a[b%2]]=(b++)%4<2?"0px":"4px"; 
 if(b>15)
 {
  clearInterval(u);
  b=0
 } 
}
function zd()
{
 clearInterval(u); 
 u=setInterval(fudu,32) 
} 
window.onload=function()
{
 var bt=document.getElementById("bt");
 var win=document.getElementById("win");
 bt.onclick=zd;
}
</script> 
</head> 
<body > 
<button id="bt">點(diǎn)擊振動(dòng)</button> 
<div id="win"></div> 
</body> 
</html>

希望本文所述對(duì)大家學(xué)習(xí)javascript程序設(shè)計(jì)有所幫助,幫助大家實(shí)現(xiàn)窗口抖動(dòng)效果。

相關(guān)文章

最新評(píng)論