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

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

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

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

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)計(jì)用戶下載網(wǎng)頁(yè)所需時(shí)間的腳本

    用js統(tǒng)計(jì)用戶下載網(wǎng)頁(yè)所需時(shí)間的腳本

    下面的方法是個(gè)不錯(cuò)的思路,建議對(duì)于js感興趣的朋友,推薦看
    2008-10-10
  • 教你用typescript類型來(lái)推算斐波那契

    教你用typescript類型來(lái)推算斐波那契

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

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

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

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

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

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

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