跨行业问两个关于表格的问题
一直在做VC开发,对做网页没有什么研究。最近一个项目却要在一个html页面上排版。遇到两个问题,一个往一个设置好高的表格里添加文字,怎样判断文本超过了表格高度;第二个是表格随文本变大后,怎样获取表格的高。网上有说能用javascript解决的,特来这里问问各位高手。能有源码当然好,能给指个方向也感激不尽,没学过这个,无从下手
------解决方案--------------------妥了,SF
L@_@K
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<title> new document </title>
<meta name= "generator " content= "editplus " />
<meta name= "author " content= "yixianggao@126.com " />
<meta name= "keywords " content= "javascript " />
<meta name= "description " content= "for javascript region of csdn " />
</head>
<body>
<table border= "1 " cellpadding= "0 ">
<tr>
<td id= "tdShow " width= "50 " height= "50 " valign= "top " style= "word-break: break-all;background-color:#ffff99 "> 1.1 </td>
<td width= "50 " height= "50 " valign= "top "> 1.2 </td>
</tr>
<tr>
<td width= "50 " height= "50 " valign= "top "> 2.1 </td>
<td width= "50 " height= "50 " valign= "top "> 2.2 </td>
</tr>
</table>
<textarea id= "taaInput " rows= "15 " cols= "70 "> Input </textarea>
<script type= "text/javascript ">
<!--
var oInput = document.getElementById( "taaInput ");
var oOutput = document.getElementById( "tdShow ");
var oShow = document.getElementById( "btnShow ");
oInput.onkeydown = function() {
oOutput.innerHTML = this.value;
};
oOutput.onpropertychange = function() {
if (this.clientHeight > parseInt(this.height))
{
var s = "Alert: over flow!\n ";
s += "Original heigth: " + this.height + "\n ";
s += "Current heigth: " + this.clientHeight + "\n ";
alert(s);
}
};
//-->
</script>
</body>
</html>
------解决方案--------------------jf