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

首頁 > 語言 > JavaScript > 正文

一個js實現的所謂的滑動門

2024-05-06 16:19:46
字體:
來源:轉載
供稿:網友
滑動門:我不理解為什么這樣叫。 
我就命名為:JMenuTab吧,因為寫它是為了當我的菜單。 

IE6,FireFox下測試通過。 
復制代碼代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>無標題文檔</title> 
<link href="JTabRes1/JMenuTab.css" rel="stylesheet" type="text/css" /> 
<style type="text/css"> 
<!-- 
body { 
    margin: 0px; 

--> 
</style> 
</head> 

<body> 
<table width="100%" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td width="200"> </td> 
    <td id="menuBar"></td> 
  </tr> 
</table> 

<div id="page1">大大小小多多少少<br /> 
人口手足</div> 
<div id="page2">ABCDEFG</div> 
<div id="page3"><img src="loading.gif" /></div> 
<div id="pageHelp"><table width="100%" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td>JMenuTab 幫助:</td> 
    </tr> 
  <tr> 
    <td>Author:xling Blog:http://xling.blueidea.com  2007/05/23 </td> 
  </tr> 
  <tr> 
    <td>寫這個程序只是為了解決燃眉之急(漢,雖然是急,我還是寫了一天)!</td> 
    </tr> 
  <tr> 
    <td>程序中用到圖片是修改了網上現有圖片,所以,外表和某些網站上的一樣,請不要見怪。因為除了圖片,全是原創(不曾參考任何類似程序)!</td> 
    </tr> 
  <tr> 
    <td>IE6,Firefox下測試通過。</td> 
  </tr> 
  <tr> 
    <td>調用方法(注意順序):</td> 
  </tr> 
  <tr> 
    <td>var menuTab = new JMenuTab(null,null,"menuBar");<br /> 
menuTab.create();<br /> 
menuTab.addTab("首頁");<br /> 
menuTab.addTab("組織架構","page1");<br /> 
menuTab.addTab("員工信息","page2");<br /> 
menuTab.addTab("業務知識","page3"); 
<br /> 
menuTab.addTab("Help","pageHelp");<br /> 
menuTab.setActiveTab(2);</td> 
  </tr> 
</table> 
</div> 
</body> 
</html> 
<script language="javascript" type="text/javascript"> 
function JMenuTab(pWidth,pHeight,pBody){ 
    var self = this; 

    //________________________________________________ 
    var width = pWidth; 
    var height = pHeight; 

    var titleHeight = 24; 
    //________________________________________________ 
    var oOutline = null; 
    var oTitleOutline = null; 
    var oPageOutline = null; 
    var oTitleArea = null; 
    var oPageArea = null; 

    var tabArray = new Array(); 
    var activedTab = null; 
    //________________________________________________ 

    var $ = function(pObjId){ 
        return document.getElementById(pObjId);     
    } 

    //________________________________________________ 

    var body = $(pBody) || document.body; 

    //________________________________________________ 

    var htmlObject = function(pTagName){ 
        return document.createElement(pTagName); 
    } 

    //________________________________________________ 

    var isRate = function(pRateString){ 
        if(!isNaN(pRateString)) return false; 
        if(pRateString.substr(pRateString.length-1,1) != "%") 
            return false; 
        if(isNaN(pRateString.substring(0,pRateString.length - 1))) 
            return false; 
        return true; 
    }     

    //________________________________________________ 

    var createOutline = function(){ 
        oOutline = htmlObject("DIV"); 
        body.appendChild(oOutline); 
        oOutline.className = "oOutline"; 
    } 

    //________________________________________________ 

    var createTitleOutline = function(){ 
        oTitleOutline = htmlObject("DIV"); 
        oOutline.appendChild(oTitleOutline); 
        oTitleOutline.className = "oTitleOutline"; 

        var vTable = htmlObject("TABLE"); 
        oTitleOutline.appendChild(vTable); 
        vTable.width = "100%"; 
        vTable.border = 0; 
        vTable.cellSpacing = 0; 
        vTable.cellPadding = 0; 

        var vTBody = htmlObject("TBODY"); 
        vTable.appendChild(vTBody); 

        var vTr1 = htmlObject("TR"); 
        vTBody.appendChild(vTr1); 

        var vTdTopLeft = htmlObject("TD"); 
        vTr1.appendChild(vTdTopLeft); 
        vTdTopLeft.height = titleHeight; 
        vTdTopLeft.className = "oTopLeft"; 

        oTitleArea = htmlObject("TD");///////////////////////////////// 
        vTr1.appendChild(oTitleArea); 
        oTitleArea.className = "oTitleArea"; 

        var vTdTopRight = htmlObject("TD"); 
        vTr1.appendChild(vTdTopRight); 
        vTdTopRight.className = "oTopRight"; 
    } 

    this.setTitleHeight = function(pHeight){ 
        //設置標題區域的高度 
    } 

    //________________________________________________ 

    var tabBtn_click = function(){ 
        self.setActiveTab(this.index); 
    } 

    var tabBtn_mouseover = function(){ 
        if(this.className =="oTabBtnActive") 
            return; 

        this.className = "oTabBtnHover"; 
    } 

    var tabBtn_mouseout = function(){ 
        if(this.className =="oTabBtnActive") 
            return; 
        this.className = "oTabBtn"; 
    }     
    //________________________________________________ 

    var createTabBtn = function(pLabel,pTabPage){ 
        var vTabBtn = htmlObject("DIV"); 
        oTitleArea.appendChild(vTabBtn); 
        vTabBtn.className = "oTabBtn"; 
        vTabBtn.index = tabArray.length; 
        vTabBtn.tabPage = pTabPage; 
        vTabBtn.onclick = tabBtn_click; 
        vTabBtn.onmouseover = tabBtn_mouseover; 
        vTabBtn.onmouseout = tabBtn_mouseout; 

        tabArray.push(vTabBtn); 

        var vTabBtnL = htmlObject("DIV"); 
        vTabBtn.appendChild(vTabBtnL); 
        vTabBtnL.className = "oTabBtnLeft"; 

        vTabBtnC = htmlObject("DIV"); 
        vTabBtn.appendChild(vTabBtnC); 
        vTabBtnC.className = "oTabBtnCenter"; 
        vTabBtnC.innerHTML = pLabel; 

        vTabBtnR = htmlObject("DIV"); 
        vTabBtn.appendChild(vTabBtnR); 
        vTabBtnR.className = "oTabBtnRight"; 
    } 

     
    var createPageOutline = function(){ 
        oPageOutline = htmlObject("DIV"); 
        oOutline.appendChild(oPageOutline); 
        oPageOutline.className = "oPageOutline"; 

        var vTable = htmlObject("TABLE"); 
        oPageOutline.appendChild(vTable); 
        vTable.width = "100%"; 
        vTable.border = 0; 
        vTable.cellSpacing = 0; 
        vTable.cellPadding = 0; 
        vTable.style.borderCollapse = "collapse"; 
        vTable.style.tableLayout="fixed"; 

        var vTBody = htmlObject("TBODY"); 
        vTable.appendChild(vTBody); 

        var vTr1 = htmlObject("TR"); 
        vTBody.appendChild(vTr1); 

        var vTdBottomLeft = htmlObject("TD"); 
        vTr1.appendChild(vTdBottomLeft); 
        vTdBottomLeft.className = "oBottomLeft"; 
        vTdBottomLeft.rowSpan = 2; 

        oPageArea = htmlObject("TD");/////////////////////////////////////// 
        vTr1.appendChild(oPageArea); 
        oPageArea.className = "oPageArea"; 
        if(oPageArea.filters) 
            oPageArea.style.cssText = "FILTER: progid:DXImageTransform.Microsoft.Wipe(GradientSize=1.0,wipeStyle=0, motion='forward');"; 
        oPageArea.height = 10; 

        var vTdBottomRight = htmlObject("TD"); 
        vTr1.appendChild(vTdBottomRight); 
        vTdBottomRight.className = "oBottomRight"; 
        vTdBottomRight.rowSpan = 2; 

        var vTr2 = htmlObject("TR"); 
        vTBody.appendChild(vTr2); 

        var vTdBottomCenter = htmlObject("TD"); 
        vTr2.appendChild(vTdBottomCenter); 
        vTdBottomCenter.className = "oBottomCenter"; 
    } 

    //________________________________________________ 

    this.addTab = function (pLabel,pPageBodyId){ 
        createTabBtn(pLabel,pPageBodyId); 
        if($(pPageBodyId)){ 
            oPageArea.appendChild($(pPageBodyId)); 
            $(pPageBodyId).style.display = "none"; 
        } 
    } 

    //________________________________________________ 

    this.setActiveTab = function(pIndex){ 
        if(oPageArea.filters) 
            oPageArea.filters[0].apply(); 

        if(activedTab != null){ 
            activedTab.className = "oTabBtn"; 
            if($(activedTab.tabPage)) 
                $(activedTab.tabPage).style.display = "none"; 
        } 
        activedTab = tabArray[pIndex]; 
        activedTab.className = "oTabBtnActive"; 
        if($(activedTab.tabPage)) 
            $(activedTab.tabPage).style.display = ""; 

        if(oPageArea.filters) 
            oPageArea.filters[0].play(duration=1); 
    }; 

    //________________________________________________ 

     
    this.create = function(){ 
        createOutline(); 
        createTitleOutline(); 
        createPageOutline(); 
    } 


var menuTab = new JMenuTab(null,null,"menuBar"); 
    menuTab.create(); 
    menuTab.addTab("首頁"); 
    menuTab.addTab("組織架構","page1"); 
    menuTab.addTab("員工信息","page2"); 
    menuTab.addTab("業務知識","page3"); 
    menuTab.addTab("ISO系統"); 
    menuTab.addTab("辦公環境"); 
    menuTab.addTab("公司新聞"); 
    menuTab.addTab("公共政策"); 
    menuTab.addTab("鏈接總部"); 
    menuTab.addTab("Help","pageHelp"); 
    menuTab.setActiveTab(2); 
</script>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 公主岭市| 南充市| 上饶县| 涞源县| 休宁县| 齐齐哈尔市| 嘉禾县| 昌吉市| 益阳市| 南汇区| 朝阳市| 边坝县| 湘乡市| 平昌县| 浮山县| 澎湖县| 临高县| 安新县| 绥中县| 甘泉县| 尚志市| 双辽市| 中山市| 普格县| 铜梁县| 谷城县| 舒城县| 封丘县| 稻城县| 左权县| 宁陵县| 张家口市| 筠连县| 武威市| 久治县| 滨海县| 上蔡县| 卢氏县| 安仁县| 齐齐哈尔市| 六枝特区|