日期:2014-05-16  浏览次数:20478 次

我想调整表的tr的高度
本帖最后由 xilaianzxsc 于 2013-09-25 09:26:19 编辑
 <tr id="table_C03" >....</tr>


<script language="javascript">
function hanshu_A()
{
table_C03.height="300"
}
</script>

运行结果是:无任何报错,那一行的高度没有变化,好象函数里面的那一行没有存在.

错在哪了?

谢谢指导。

------解决方案--------------------
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk" />
<title></title>

<style>
td { border:1px solid red; }
</style>
</head>
<body>
<table>
<tr id="test">
<td>123</td>
</tr>
</table>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}

$('test').style.height = '100px'
</script>
</body>
</html>

------解决方案--------------------
<table>
<tr id="tr1" style="background-color:red;"><td>5</td></tr>
</table>
<input type='button' value='change' onclick='javascript:document.getElementById("tr1").height=100;' />

------解决方案--------------------
table_C03.style.height="300px"