61,112
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
.yesScroll {
width: 100%;
background-color: #666666;
overflow-x: auto;
overflow-y: scroll;
padding: 0px;
}
.tblDetail {
background-color: white;
border-width: 1px;
border-color: snow;
border-style: solid;
border-collapse: collapse;
margin: 0px;
float: left;
}
.thCenter {
font-size: 12px;
font-weight: normal;
color: #113388;
background-color: #d4e3ff;
text-align: center;
vertical-align: middle;
border-collapse: collapse;
border-right-width: 1px;
border-bottom-width: 3px;
border-right-color: #a1a1a1;
border-bottom-color: #a1a1a1;
border-right-style: solid;
border-bottom-style: solid;
height: 20px;
padding-left: 4px;
padding-right: 4px;
white-space:nowrap;
}
.trOdd {
background-color:#ffffff;
}
.trEven {
background-color:#f0ffff;
}
.tdLeft {
font-size: 12px;
text-align: left;
vertical-align: middle;
margin-left: 2px;
margin-right: 2px;
border-collapse: collapse;
border-right-width: 1px;
border-bottom-width: 1px;
border-right-color: #a1a1a1;
border-bottom-color: #a1a1a1;
border-right-style: solid;
border-bottom-style: solid;
height: 20px;
padding-left: 4px;
padding-right: 4px;
white-space:nowrap;
color: #000000;
}
</style>
</head>
<body>
<table style="width:770px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div id="master" class="yesScroll" style="width:770px;height:225px">
<table id="myTable" cellspacing="0" cellpadding="0" class="tblDetail" style="width:100%;">
<thead>
<tr>
<th nowrap class="thCenter">AAA </th>
<th nowrap class="thCenter">BBB </th>
</tr>
</thead>
<tbody>
<tr onclick="lineSelect(this);" class="trOdd">
<td nowrap class="tdLeft">PDF </td>
<td nowrap class="tdLeft">111 </td>
</tr>
<tr onclick="lineSelect(this);" class="trEven">
<td nowrap class="tdLeft">CSV </td>
<td nowrap class="tdLeft">222 </td>
</tr>
<tr onclick="lineSelect(this);" class="trOdd">
<td nowrap class="tdLeft">TXT </td>
<td nowrap class="tdLeft">333 </td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</table>
<script type="text/javascript">
var myTable = document.getElementById("myTable");
if (myTable.offsetParent.clientWidth < myTable.offsetParent.offsetWidth)
{
//IE 的 clientWidth 不包括边框,FF 包括。
myTable.style.width = myTable.offsetParent.clientWidth + "px";
}
</script>
</body>
</html>