日期:2014-05-17 浏览次数:20503 次
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void tableHeight_Click(object sender, EventArgs e)
{
Response.Write("table的高度为:" + heightID.Value);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="tableHeight_Click" OnClientClick="getTabelHeight()" />
<asp:HiddenField ID="heightID" runat="server" />
<table id="aaa">
<tr>
<td><img src="http://images.csdn.net/20131119/CASH8310_%E5%89%AF%E6%9C%AC.jpg" /></td>
</tr>
</table>
<script>
function getTabelHeight(){
document.getElementById('<%=heightID.ClientID%>').value= document.getElementById('aaa').offsetHeight;
}
</script>
</div>
</form>
</body>
</html>