posts - 35,  comments - 6,  trackbacks - 0
           1 function continueAdd(obj)
           2 {
           3    //設置顯示位置
           4        var left=calulateoffset(obj,"offsetLeft");
           5        var top=calulateoffset(obj,"offsetTop")+obj.offsetHeight;
           6      var table1=document.getElementById("table1");    
           7        table1.style.left=100+left+"px";
           8        table1.style.top=top+"px";
           9     document.all.table1.style.display="block";
          10 }
          11 
          12 //計算顯示位置函數
          13 function calulateoffset(field,attr)
          14 {
          15     var offset=0;
          16     while(field)
          17     {
          18         offset+=field[attr];
          19         field=field.offsetParent;
          20     }
          21     return offset;
          22 }
          23 
          記得要定義div的position 為absolute
          1 <DIV id=table1 style="POSITION: absolute">
          附mose變為手型:course:handle
          posted on 2007-05-25 08:02 NG 閱讀(769) 評論(1)  編輯  收藏 所屬分類: javascript


          FeedBack:
          # re: 定義層的顯示位置
          2007-09-28 17:11 | 千里冰封
          JS確實很強大  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2007年9月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          常用鏈接

          留言簿(1)

          隨筆檔案(35)

          文章分類(5)

          文章檔案(2)

          新聞檔案(5)

          java link

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 抚顺县| 炎陵县| 高阳县| 高州市| 宿迁市| 苍溪县| 禄劝| 梅州市| 大关县| 拜城县| 曲麻莱县| 顺昌县| 敦化市| 丰城市| 遵义县| 饶平县| 芜湖县| 武冈市| 台前县| 江西省| 建平县| 上高县| 灵石县| 海淀区| 汉阴县| 江西省| 平利县| 蚌埠市| 潮安县| 中西区| 如皋市| 德昌县| 滦平县| 隆安县| 宜良县| 元氏县| 资溪县| 新密市| 德钦县| 和田县| 奇台县|