国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

js運動應用實例解析

2019-11-20 10:54:27
字體:
來源:轉載
供稿:網友

本文為大家提供了兩個js運動應用實例,分享給大家,具體實現內容如下

應用1,完成如下效果:

js代碼如下:

<script src="move.js"></script><script>window.onload=function (){  var oDiv=document.getElementById('play');  var aBtn=oDiv.getElementsByTagName('ol')[0].getElementsByTagName('li');  var oUl=oDiv.getElementsByTagName('ul')[0];    var now=0;  for(var i=0;i<aBtn.length;i++)  {    aBtn[i].index=i;    aBtn[i].onclick=function ()    {      now=this.index;      tab();    };  }    function tab()  {    for(var i=0;i<aBtn.length;i++)    {      aBtn[i].className='';    }    aBtn[now].className='active';    startMove(oUl, {top: -150*now});  }    function next()  {    now++;    if(now==aBtn.length){now=0;}    tab();  }    var timer=setInterval(next, 2000);    oDiv.onmouseover=function (){clearInterval(timer);};    oDiv.onmouseout=function (){timer=setInterval(next, 2000);};};</script>

應用2,完成如下效果:

代碼如下:

<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><style type="text/css">.....</style><script type="text/javascript" src="move.js"></script><script type="text/javascript">window.onload=function (){  var oBtn=document.getElementById('but');  var oBottom=document.getElementById('zns_bottom');  var oBox=document.getElementById('zns_box');  var oBtnClose=document.getElementById('btn_close');    oBox.style.display='block';  var initBottomRight=parseInt(getStyle(oBottom, 'right'));  var initBoxBottom=parseInt(getStyle(oBox, 'bottom'));  oBox.style.display='none';    oBtn.onclick=openHandler;  oBtnClose.onclick=closeHandler;    function openHandler()  {    startMove(oBottom, {right: 0}, function (){      oBox.style.display='block';      startMove(oBox, {bottom: 0});    });    oBtn.className='but_hide';    oBtn.onclick=closeHandler;  }    function closeHandler()  {    startMove(oBox, {bottom: initBoxBottom}, function (){      oBox.style.display='none';      startMove(oBottom, {right: initBottomRight}, function (){        oBtn.className='but_show';      });    });    oBtn.onclick=openHandler;  }};</script></head><body>  ......</body></html>

以上就是本文的全部內容,希望對大家的學習有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 应用必备| 防城港市| 民和| 丹棱县| 会同县| 皋兰县| 特克斯县| 专栏| 洛隆县| 潍坊市| 綦江县| 富锦市| 长岛县| 鹤壁市| 鄄城县| 黄石市| 宜阳县| 瑞昌市| 普陀区| 获嘉县| 同仁县| 清水河县| 琼结县| 东阳市| 锡林郭勒盟| 公安县| 会同县| 那坡县| 寻甸| 西城区| 乌兰县| 铜山县| 板桥市| 额尔古纳市| 秀山| 清镇市| 永康市| 杭州市| 泾阳县| 镇安县| 工布江达县|