<table border='1'><tr>
<td width='50%'>
<table ><tr ><td >111111111</td></tr></table>
</td>
<td width='50%'>
<table ><tr ><td >222</td></tr></table>
</td>
</tr></table>这样不就行了?
<td width='50%'>
<table ><tr ><td >111111111</td></tr></table>
</td>
<td width='50%'>
<table ><tr ><td >222</td></tr></table>
</td>
</tr></table>这样不就行了?
严重怀疑楼主的智商,还是好好去看看html基础吧
<table id="table1" border="1" ><tr ><td >111111111<br>aa</td></tr></table><table id="table2" border="1" ><tr ><td >1111111222222211</td></tr></table><script language=javascript>
var width1=document.getElementById("table1").offsetWidth;
var width2=document.getElementById("table2").offsetWidth;
if(parseInt(width1)>parseInt(width2))
{
document.getElementById("table2").style.width=document.getElementById("table1").offsetWidth
}
else
{
document.getElementById("table1").style.width=document.getElementById("table2").offsetWidth
}
var height1=document.getElementById("table1").offsetHeight;
var height2=document.getElementById("table2").offsetHeight;
if(parseInt(height1)>parseInt(height2))
{
document.getElementById("table2").style.height=document.getElementById("table1").offsetHeight
}
else
{
document.getElementById("table1").style.height=document.getElementById("table2").offsetHeight
}
</script>
同时对 mqzhuang(独角兽) 表示谦意,我的意思确实是指单元格的每一行的高度,我说成列宽可能造成了误会,不好意思!
表设计如下:
<table border='1'>
<tr>
<td width='50%'>
<table>
<tr><td>1</td></tr>
...
<tr><td>2</td></tr>
</table>
</td>
<td width='50%'>
<table>
<tr><td>3</td></tr>
...
<tr><td>4</td></tr>
</table>
</td>
</tr></table>
要求:
<td>1</td>和<td>3</td>高度相同
...
<td>2</td>和<td>4</td>高度相同
如何实现呢?
<table border='1'>
<tr>
<td width='50%'>
<table id="table1" border="1">
<tr><td>1<br>2</td></tr>
<tr><td>2</td></tr>
</table>
</td>
<td width='50%'>
<table id="table2" border="1">
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
</td>
</tr></table>
<script language=javascript>
var objtable1=document.getElementById("table1").childNodes[0].childNodes;
var objtable2=document.getElementById("table2").childNodes[0].childNodes;
for(var i=0;i<objtable1.length;i++)
{
var height1=objtable1[i].offsetHeight;
var height2=objtable2[i].offsetHeight;
if(parseInt(height1)>parseInt(height2))
{
objtable2[i].style.height=objtable1[i].offsetHeight
}
else
{
objtable1[i].style.height=objtable2[i].offsetHeight
}
}
</script>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="../WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="../WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="../WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="../WEB-INF/bbscs.tld" prefix="bbscs" %>
<%@ page import="com.laoer.bbscs.sys.*"%>
<html:html locale="true">
<!-- -->
<title><bean:message key="perf.ygjxkpb"/></title>
<link href="../css/css0.css" rel="stylesheet" type="text/css">
<script language=javascript>
var objtable1=document.getElementById("table1").childNodes[0].childNodes;
var objtable2=document.getElementById("table2").childNodes[0].childNodes;
for(var i=0;i<objtable1.length;i++)
{
var height1=objtable1[i].offsetHeight;
var height2=objtable2[i].offsetHeight;
if(parseInt(height1)>parseInt(height2))
{
objtable2[i].style.height=objtable1[i].offsetHeight
}
else
{
objtable1[i].style.height=objtable2[i].offsetHeight
}
}
</script>
<script language="JavaScript">
function View(i) { info[i].style.display = info[i].style.display == '' ? 'none' : ''; }
</script>
<body leftmargin="0" topmargin="0" bgcolor="#FFFFFF">
<br><br>
<div align="center"><strong><b><span class="style1"><bean:message key="perf.ygjxkpb"/></span></b></strong>
</div><br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.name"/></div></td>
<td height="25" nowrap> <bean:write name="um" property="cnName"/></td>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.workno"/></div></td>
<td height="25" nowrap> <bean:write name="um" property="workNo"/></td>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.department"/></div></td>
<td height="25" nowrap> <bean:write name="upe" property="deptName"/></td>
</tr>
<tr>
<td height="25" nowrap><div align="center"><bean:message key="perf.gangwei"/></div></td>
<td height="25" nowrap> <bean:write name="upe" property="postName"/></td>
<td height="25" nowrap><div align="center"><bean:message key="perf.checkmonthly"/></div></td>
<td height="25" colspan="3" nowrap> <bbscs:dateTimes name="um" property="month" style="yyyy-MM"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="15%" rowspan="2" nowrap><div align="center"><bean:message key="perf.khys"/></div></td>
<td rowspan="2" width="65%" nowrap><div align="center"><bean:message key="perf.khnr"/></div></td>
<td height="25" width="20%" colspan="2" nowrap><div align="center"><bean:message key="perf.khjj"/></div></td>
</tr>
<tr>
<td width="10%" height="22" nowrap><div align="center"><bean:message key="perf.zwpd"/></div></td>
<td width="10%" height="22" nowrap><div align="center"><bean:message key="perf.sjpd"/></div></td>
</tr>
<tr>
<td colspan="2">
<table id="table1" width="100%" border="1" cellspacing="1" cellpadding="1">
<logic:iterate id="ul" name="clist" type="com.laoer.bbscs.bean.Catalog">
<tr>
<td width="18%"><div align="center"><bean:write name="ul" property="catalog"/><bean:write name="ul" property="percent"/>%</div></td>
<td>
<logic:match name="ul" property="catalog" value="内容">
<table width="100%" border="1" cellpadding="1" cellspacing="1">
<tr>
<td height="22"><div align="center"><bean:message key="perf.sjyq"/></div></td>
<td height="22"><div align="center"><bean:message key="perf.finishcircs"/></div></td>
</tr>
<tr>
<td><div align="left"><bbscs:forum type="matter" name="um"/></div></td>
<td><div align="left"><bbscs:forum type="accomplish" name="um"/></div></td>
</tr>
</table>
</logic:match>
<logic:notMatch name="ul" property="catalog" value="内容">
<bbscs:forum type="cataDesc" name="ul"/>
</logic:notMatch> </td>
</tr>
</logic:iterate>
</table>
</td>
<td width="10%">
<table id="table2" width="100%" border="1" cellpadding="1" cellspacing="1">
<logic:iterate id="us" name="slist" type="com.laoer.bbscs.bean.Scoring">
<tr>
<td><div align="center"><bean:write name="us" property="score"/></div></td>
</tr>
</logic:iterate>
</table>
</td>
<td width="10%">
<table id="table3" width="100%" border="1" cellpadding="1" cellspacing="1">
<logic:iterate id="us1" name="s1list" type="com.laoer.bbscs.bean.Scoring">
<tr>
<td><div align="center"><bean:write name="us1" property="score"/></div></td>
</tr>
</logic:iterate>
</table>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.bossre"/></div></td>
<td colspan="3"> <bbscs:forum type="opinion" name="um"/></td>
</tr>
<tr>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.zhpf"/></div></td>
<td width="30%" nowrap> <bean:write name="upe" property="tolScore"/></td>
<td width="20%" nowrap><div align="center"><bean:message key="perf.kpr"/></div></td>
<td width="35%" height="25" nowrap> <bean:write name="um" property="editer"/></td>
</tr>
<tr>
<td width="15%" height="25" nowrap><div align="center"><bean:message key="perf.re"/></div></td>
<td height="25" colspan="3"> <bean:message key="perf.re1"/></td>
</tr>
</table></td>
</tr>
</table>
</html:html>
<tr>
<td width='50%'>
<table id="table1" border="1">
<tr><td>1<br>2</td></tr>
<tr><td>2</td></tr>
</table>
</td>
<td width='50%'>
<table id="table2" border="1">
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
</td>
</tr></table>
<script language=javascript>
var objtable1=document.getElementById("table1").childNodes[0].childNodes;
var objtable2=document.getElementById("table2").childNodes[0].childNodes;
for(var i=0;i<objtable1.length;i++)
{
var height1=objtable1[i].offsetHeight;
var height2=objtable2[i].offsetHeight;
if(parseInt(height1)>parseInt(height2))
{
objtable2[i].style.height=objtable1[i].offsetHeight+parseInt(10)
}
else
{
objtable1[i].style.height=objtable2[i].offsetHeight+parseInt(10)
}
}
</script>
<table border='1'>
<tr>
<td width='50%'>
<table id="table1" border="1">
<tr><td>1<br>2</td></tr>
<tr><td>2</td></tr>
</table>
</td>
<td width='50%'>
<table id="table2" border="1">
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
</td>
</tr></table>
<script language=javascript>
var objtable1=document.getElementById("table1").childNodes[0].childNodes;
var objtable2=document.getElementById("table2").childNodes[0].childNodes;
for(var i=0;i<objtable1.length;i++)
{
var height1=objtable1[i].offsetHeight;
var height2=objtable2[i].offsetHeight;
if(parseInt(height1)>parseInt(height2))
{
objtable2[i].style.height=objtable1[i].offsetHeight+parseInt(10)
objtable1[i].style.height=objtable1[i].offsetHeight+parseInt(10)
}
else
{
objtable1[i].style.height=objtable2[i].offsetHeight+parseInt(10)
objtable2[i].style.height=objtable2[i].offsetHeight+parseInt(10)
}
}
</script>
如
<table border='1'>
<tr>
<td width='50%'>
<table id="table1" border="1">
<tr><td>1<br>2</td></tr>
<tr>
<td>
<table width="100%" border="1">
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
</table>
</td></tr>
</table>
</td>
<td width='50%'>
<table id="table2" border="1">
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
</td>
</tr></table>