<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 154  文章 - 60  trackbacks - 0
    <2007年11月>
    28293031123
    45678910
    11121314151617
    18192021222324
    2526272829301
    2345678

    聲明:

    該blog是為了收集資料,認(rèn)識(shí)朋友,學(xué)習(xí)、提高技術(shù),所以本blog的內(nèi)容除非聲明,否則一律為轉(zhuǎn)載!!

    感謝那些公開(kāi)自己技術(shù)成果的高人們!!!

    支持開(kāi)源,尊重他人的勞動(dòng)!!

    常用鏈接

    留言簿(3)

    隨筆分類(148)

    隨筆檔案(143)

    收藏夾(2)

    其他

    學(xué)習(xí)(技術(shù))

    觀察思考(非技術(shù))

    搜索

    •  

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    代碼:
    <html>
    <head>
    <title>My table</title>
    <style>
    .table0 
    {
        height
    :90%;
    }


    .table0 caption
    {
        width
    :100%;
        height
    :26px;
        line-height
    :26px;
        font-size
    :20px;
        font-color
    :black;
        font-weight
    :900;
        letter-spacing
    :5px;
    }


    .table0 thead td 
    {
        text-align
    :center;
        vertical-align
    :middle;
        height
    :20px;
        line-height
    :18px;
        font-size
    :14px;
        font-color
    :black;
        font-weight
    :bold;
        padding-top
    :2px;
        padding-bottom
    :2px;
        border
    :#555 1px solid;
        margin
    :0px;
    }


    .table0 tfoot td
    {
        text-align
    :left;
        vertical-align
    :middle;
        height
    :20px;
        line-height
    :18px;
        font-size
    :12px;
        font-color
    :black;
        font-weight
    :bold;
        padding-top
    :2px;
        padding-bottom
    :2px;
        padding-left
    :12px;
        padding-right
    :12px;
        border
    :#555 1px solid;
    }


    .table0 tbody td 
    {
        width
    :100%;
        height
    :auto;
        border
    :#555 1px solid;
        padding
    :0px;
        margin
    :0px;
    }


    .table1 tbody td 
    {
        text-align
    :left;
        vertical-align
    :middle;
        height
    :20px;
        line-height
    :18px;
        font-size
    :14px;
        font-color
    :#444;
        font-weight
    :normal;
        padding-top
    :2px;
        padding-bottom
    :2px;
        padding-left
    :12px;
        padding-right
    :12px;
        border-right
    :#555 1px solid;
        border-bottom
    :#555 1px solid;
        overflow
    :hidden;
        text-overflow
    :ellipsis;
        word-break
    :keep-all;
        word-wrap
    :normal;
    }


    </style>
    <script>

    function init(){
        theT
    =createTable("我的收藏夾",["Group:150","Name:300","URL:200","Visited:100","Modify:100","Delete:100"]);
        
    //參數(shù)說(shuō)明:createTable(strCaption,colHeads)
        //strCaption 標(biāo)題
        //colHeads 是一個(gè)array,每個(gè)item的格式是 名稱:寬度 的字符串
        for(var i=0;i<40;i++){
            theR
    =theT.insertRow();
            
    for(var j=0;j<7;j++){
                theC
    =theR.insertCell();
                theC.innerText
    =j;
            }

        }

    }



    function createTable(strCaption,colHeads){
        
    //參數(shù)說(shuō)明:colHeads 是一個(gè)array,每個(gè)item的格式是 名稱:寬度 的字符串
        //生成表格
        oTable=document.createElement("table");
        document.body.insertBefore(oTable);
        
    //設(shè)置class
        oTable.className="table0";
        
        
    with(oTable.style){
            tableLayout
    ="fixed";
            borderCollapse
    ="collapse"
            borderSpacing
    ="0px";
        }

        
    //設(shè)置變量
        oTCaption=oTable.createCaption();
        oTHead
    =oTable.createTHead();
        oTFoot
    =oTable.createTFoot();
        
        
    //生成標(biāo)題
        oTCaption.innerText=strCaption;
        
        
    //設(shè)置列寬
        oTHead.insertRow();
        
    for(var i=0;i<colHeads.length;i++){
            tHeadName
    =colHeads[i].split(":")[0];
            tHeadWidth
    =isNaN(parseInt(colHeads[i].split(":")[1]))?"auto":parseInt(colHeads[i].split(":")[1]);
            theCell
    =oTHead.rows[0].insertCell();
            theCell.style.width
    =tHeadWidth;
        }

        theCell
    =oTHead.rows[0].insertCell();
        theCell.width
    =20;
        oTHead.rows[
    0].style.display="none";
        
        
    //生成表頭
        oTHead.insertRow();
        
    for(var i=0;i<colHeads.length;i++){
            tHeadName
    =colHeads[i].split(":")[0];
            tHeadWidth
    =isNaN(parseInt(colHeads[i].split(":")[1]))?"auto":parseInt(colHeads[i].split(":")[1]);
            theCell
    =oTHead.rows[1].insertCell();
            theCell.innerText
    =tHeadName;
            theCell.style.width
    =tHeadWidth;
        }

        theCell
    =oTHead.rows[1].insertCell();
        theCell.width
    =24;
        
        
    //生成表腳
        oTFoot.insertRow();
        theCell
    =oTFoot.rows[0].insertCell();
        theCell.innerHTML
    ="<marquee scrollDelay=50 scrollAmount=2>Copy rights 2005. Hutia presents.</marquee>";
        theCell
    =oTFoot.rows[0].insertCell();
        theCell.colSpan
    =colHeads.length-1;
        theCell
    =oTFoot.rows[0].insertCell();
        theCell.width
    =20;
        
        
    //生成主體
        oTable.all.tags("Tbody")[0].insertRow();
        theCell
    =oTable.all.tags("Tbody")[0].rows[0].insertCell();
        theCell.colSpan
    =colHeads.length+1;
        oMain
    =document.createElement("DIV");
        theCell.insertBefore(oMain);
        
    with(oMain.style){
            width
    ="100%";
            height
    ="100%";
            overflowY
    ="auto";
            overflowX
    ="hidden";
            margin
    ="0px";
            marginLeft
    ="-1px";
        }

        
        oTBody
    =document.createElement("table");
        oMain.insertBefore(oTBody);
        oTable.oTBody
    =oTBody;
        
    //禁止選擇
        oTCaption.onselectstart=oTHead.onselectstart=oTFoot.onselectstart=function(){return(false);}
        
        
    //設(shè)置class
        oTBody.className="table1";
        
    with(oTBody.style){
            width
    =oTable.offsetWidth-15;
            tableLayout
    ="fixed";
            borderCollapse
    ="collapse"
            borderSpacing
    ="0px";
            padding
    ="0px";
            margin
    ="0px";
        }

        
        
    //初始化列寬
        oTBody.insertRow();
        
    for(var i=0;i<colHeads.length;i++){
            tHeadWidth
    =isNaN(parseInt(colHeads[i].split(":")[1]))?"auto":parseInt(colHeads[i].split(":")[1]);
            theCell
    =oTBody.rows[0].insertCell();
            theCell.style.width
    =tHeadWidth;
        }

        oTBody.rows[
    0].style.display="none";
        
        
    return(oTBody);
    }


    function insertRow(){
        
    var intL=oTBody.rows.length;
        theRow
    =oTBody.insertRow();
        theRow.index
    =intL;
        theRow.onmouseover
    =rowOnMouseOver;
        theRow.onmouseout
    =rowOnMouseOut;
        theRow.onclick
    =rowOnClick;
        
    for(var i=0;i<colHeads.length;i++){
            theCell
    =theRow.insertCell();
            theCell.tabIndex
    =0;
            theCell.hideFocus
    =true;
            theCell.colIndex
    =i;
            theCell.onmouseover
    =function(){this.focus();};
            theCell.onmouseout
    =cellOnBlur;
            theCell.onfocus
    =cellOnFocus;
            theCell.onblur
    =cellOnBlur;
        }

        theRow.cells[
    0].innerText=strGroup?strGroup:"ROOT";
        theRow.cells[
    1].innerText=strName?strName:"Untitled Document.";
        theRow.cells[
    2].innerText=strURL?strURL:"Unspecified URL";
        theRow.cells[
    3].innerHTML=strVisited?"Yes".fontcolor("red"):"Unknow";
        theRow.cells[
    4].innerHTML=strModify?"Yes".fontcolor("red"):"No".fontcolor("Green");
        theRow.cells[
    5].innerHTML="Delete".fontcolor("red");
    }


    </script>
    </head>
    <body onload="init();">

    </body>
    </html>
    posted on 2007-11-29 17:23 lk 閱讀(10123) 評(píng)論(1)  編輯  收藏 所屬分類: ajax&js

    FeedBack:
    # re: js table操作--------table滾動(dòng)條 2012-03-12 10:00 jing
    這個(gè)用火狐測(cè)試不通過(guò)呀  回復(fù)  更多評(píng)論
      
    主站蜘蛛池模板: 亚洲日韩精品国产一区二区三区| 中文在线观看永久免费| 免费人妻av无码专区| 中文字幕无线码中文字幕免费| 亚洲今日精彩视频| 成年人网站在线免费观看| 有色视频在线观看免费高清在线直播| 亚洲中文久久精品无码| 青娱乐免费在线视频| 欧洲乱码伦视频免费国产| 亚洲精品天天影视综合网| 日本免费福利视频| 日韩精品无码一区二区三区免费| 亚洲乱码日产精品一二三| 国产亚洲av片在线观看16女人| 毛片免费在线播放| 免费av片在线观看网站| 亚洲经典千人经典日产| 久久亚洲免费视频| 国产大片91精品免费观看男同 | 国产成人综合亚洲| 亚洲伊人tv综合网色| 午夜亚洲福利在线老司机| 国产高清免费视频| 久久久WWW免费人成精品| 国产亚洲精品影视在线| 亚洲2022国产成人精品无码区| 日本牲交大片免费观看| 四虎1515hh永久久免费| 久久精品免费网站网| 国产精品亚洲lv粉色| 亚洲人成人77777在线播放| 久久精品九九亚洲精品天堂| 国产成人免费片在线观看| 曰批视频免费30分钟成人| 国产精品视频白浆免费视频| xxxxx做受大片视频免费| 在线观看亚洲专区| 亚洲中文精品久久久久久不卡| 91亚洲导航深夜福利| 亚洲狠狠久久综合一区77777|