欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js style動態(tài)設(shè)置table高度

 更新時間:2014年10月21日 17:20:16   投稿:whsnow  
設(shè)置table高度想必大家都會,直接在table標(biāo)簽中設(shè)置下不就行了嗎?這是靜態(tài)的,如果要動態(tài)設(shè)置你會嗎?下面的實(shí)例將教會大家

直接在table標(biāo)簽中設(shè)置下不就行了嗎?這是靜態(tài)的,如果要動態(tài)設(shè)置你會嗎?

function com_onresize(){

var contentsHeight = document.body.clientHeight;
var buttonsHeight = document.getElementById( "buttons" ).offsetHeight;
var head1Height = document.getElementById( "head1" ).offsetHeight;
var head2Height = document.getElementById( "head2" ).offsetHeight;

var t1 = document.getElementById( "TableContainer1" ).style.height;
var t2 = document.getElementById( "TableContainer2" ).style.height;

//alert(document.getElementById( "TableContainer1" ).style.height);
var h = contentsHeight - buttonsHeight - head1Height - head2Height - 13;
if(h < 110){
return;
}
document.getElementById( "TableContainer1" ).style.height = h/2 + 'px';
document.getElementById( "TableContainer2" ).style.height = h/2 + 'px';
}
function com_sbs_pagesize(){
var screenHeight = window.screen.height;
  var availHeight = window.screen.availHeight;
  //alert(document.getElementById( "TableContainer1" ).children[0].rows.length);
  var index = document.getElementById( "TableContainer1" ).children[0].rows.length
  var buttonsHeight = document.getElementById( "buttons" ).offsetHeight;
var head1Height = document.getElementById( "head1" ).offsetHeight;
var head2Height = document.getElementById( "head2" ).offsetHeight;

  var mainH = buttonsHeight + head1Height +head2Height + 13;
  //20:scroll 35:title 25:tr
  while ((availHeight-mainH) < (20 + 35 + 25*index)*2)
{
 index = index - 1;
}
var tableHeight = 20 + 35 + 25*index;
  document.getElementById( "TableContainer1" ).style.height = tableHeight + 'px';
  document.getElementById( "TableContainer2" ).style.height = tableHeight + 'px';
  window.resizeTo(document.body.offsetWidth,mainH + tableHeight*2);
} 

相關(guān)文章

  • 用js統(tǒng)計用戶下載網(wǎng)頁所需時間的腳本

    用js統(tǒng)計用戶下載網(wǎng)頁所需時間的腳本

    下面的方法是個不錯的思路,建議對于js感興趣的朋友,推薦看
    2008-10-10
  • 教你用typescript類型來推算斐波那契

    教你用typescript類型來推算斐波那契

    斐波那契是自然界與社會中存在的一種數(shù)學(xué)規(guī)律,下面這篇文章主要給大家介紹了關(guān)于如何用typescript類型來推算斐波那契的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-01-01
  • JS跳出循環(huán)的方法區(qū)別對比分析(break,continue,return)

    JS跳出循環(huán)的方法區(qū)別對比分析(break,continue,return)

    面向?qū)ο缶幊陶Z法中我們會碰到break ,continue, return這三個常用的關(guān)鍵字,那么關(guān)于這三個關(guān)鍵字的使用具體的操作是什么呢?接下來通過本文給大家講解JS跳出循環(huán)的方法區(qū)別對比分析(break,continue,return),感興趣的朋友一起看看吧
    2023-02-02
  • JavaScript給數(shù)組添加元素的6個方法

    JavaScript給數(shù)組添加元素的6個方法

    本文主要介紹了JavaScript給數(shù)組添加元素的6個方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • Javascript 學(xué)習(xí)書 推薦

    Javascript 學(xué)習(xí)書 推薦

    前一段時間看了一本javascript的書,書名為Javascript DOM 高級程序設(shè)計 由【加】Jeffrey Sambells和【美】
    2009-06-06
  • 最新評論