请教js如何实现让table的表头的高度固定

JavaScript011

请教js如何实现让table的表头的高度固定,第1张

方法<html>

<head>

<meta http-equiv="content-type" content="text/htmlcharset=utf-8">

<META http-equiv="Content-Style-Type" content="text/css">

</head>

<script language=javascript>

var t, n, c

window.onload=function(){

t = document.getElementById("tb")

t.rows[0].style.height="50px" //在这里设置高度

}

window.outerheight

窗口总高度

和window.screen.availheight一样

window.innerheight

窗口可视区域高度

window.screen.height

显示器屏幕高度

另外:jquery获取高度

$(".thiscrumbs").height()

元素本身高度

$(".thiscrumbs").innerheight()

元素高度+内边距

$(".thiscrumbs").outerheight()

元素高度+内边距+边框

$(".thiscrumbs").outerheight(true)

元素高度+内边距+边框+外边距

以table为例,首先为其设计class或者id如:id为table

然后进入js中

定义一个对象

var table=document.getelementbyid("table")

这是获取这个元素

然后宽和高

就是table.width

table.height