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

首頁 > 編程 > JavaScript > 正文

JS使用面向?qū)ο蠹夹g(shù)實現(xiàn)的tab選項卡效果示例

2019-11-19 17:23:55
字體:
供稿:網(wǎng)友

本文實例講述了JS使用面向?qū)ο蠹夹g(shù)實現(xiàn)的tab選項卡效果。分享給大家供大家參考,具體如下:

運行效果圖如下:

代碼如下:

html:

<ul class="scrollUl">  <li id="m01" class="sd01" value="0"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >新服排期</a></li>  <li id="m02" class="sd02" value="1"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >官方公告</a></li></ul><div id="c01" style="display: block;">  <ul>    <li class="ml10 mt10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="最三國“群雄逐鹿”震撼開啟 敬請期待." class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >最三國“群雄逐鹿”震撼開啟 ...</a></span><span class="hui9">09-28</span></li>  </ul></div><div class="hidden" id="c02" style="display: none;">  <ul>    <li class="ml10 mt10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>    <li class="ml10"><span class="fu"><a title="《絕地戰(zhàn)爭》9月8日維護(hù)公告" class="hei" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >《絕地戰(zhàn)爭》9月8日維護(hù)公告</a></span><span class="hui9">09-28</span></li>   </ul></div>

js:

function scrollDoor(){}scrollDoor.prototype = {  sd : function(menus,divs,openClass,closeClass){    var _this = this;    if(menus.length != divs.length)    {      alert("菜單層數(shù)量和內(nèi)容層數(shù)量不一樣!");      return false;    }    for(var i = 0 ; i < menus.length ; i++)    {      _this.$(menus[i]).value = i;      _this.$(menus[i]).onmouseover = function(){        //1.先關(guān)閉所有的導(dǎo)航和內(nèi)容:        for(var j = 0 ; j < menus.length ; j++)        {          _this.$(menus[j]).className = closeClass;          _this.$(divs[j]).style.display = "none";        }        //2.打開當(dāng)前的導(dǎo)航和內(nèi)容:        //_this.$(menus[this.value]).className = openClass;        this.className = openClass;        _this.$(divs[this.value]).style.display = "block";      }    }  },  $ : function(oid){    if(typeof(oid) == "string")    return document.getElementById(oid);    return oid;  }}window.onload = function(){  var SDmodel = new scrollDoor();  SDmodel.sd(["m01","m02"],["c01","c02"],"sd01","sd02");  //SDmodel.sd(["m001","m002"],["c001","c002"],"sd01","sd02");}

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《javascript面向?qū)ο笕腴T教程》、《JavaScript錯誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》、《JavaScript遍歷算法與技巧總結(jié)》及《JavaScript數(shù)學(xué)運算用法總結(jié)

希望本文所述對大家JavaScript程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 旌德县| 星子县| 高淳县| 乐业县| 中山市| 凤台县| 台湾省| 进贤县| 施秉县| 思茅市| 司法| 托里县| 弥渡县| 盐边县| 仁布县| 桐乡市| 浦北县| 漾濞| 平舆县| 三门县| 九龙城区| 承德县| 通道| 阜宁县| 胶南市| 清徐县| 海城市| 洛川县| 定远县| 土默特左旗| 邮箱| 靖州| 南江县| 庆阳市| 黄大仙区| 成武县| 尉犁县| 牡丹江市| 邹城市| 思茅市| 榆林市|