<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>这样不就行了?

解决方案 »

  1.   

    我需要><td >111111111</td>和<td  >222</td>高度一样.
      

  2.   

    你问题里说的是列宽,现在又高度?
    严重怀疑楼主的智商,还是好好去看看html基础吧
      

  3.   


    <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>
      

  4.   

    谢谢楼上的提供方法!~
    同时对 mqzhuang(独角兽) 表示谦意,我的意思确实是指单元格的每一行的高度,我说成列宽可能造成了误会,不好意思!
      

  5.   

    我重新解释一下问题
    表设计如下:
    <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>高度相同
    如何实现呢?
      

  6.   

    为了看起来方便,我加了border,如果不需要,可以去掉
    <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>
      

  7.   

    将代码贴出:
    <%@ 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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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">&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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">&nbsp;&nbsp;<bean:message key="perf.re1"/></td>
          </tr>
        </table></td>
      </tr>
    </table>
    </html:html>
      

  8.   

    <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)
    }
    else
    {
    objtable1[i].style.height=objtable2[i].offsetHeight+parseInt(10)
    }
    }

    </script>
      

  9.   

    好像不行,objtable2[i].style.height=objtable1[i].offsetHeight+parseInt(10),不就是把表2的单元格高加10了吗?那表1呢?
      

  10.   

    表1在下面else里了啊,因为你不知道是表1高还是表2高,所以要判断下我写的objtable1这个对象是个数组存的是表1的各行,不是表1,这里对不起,我命名命的不好。
      

  11.   

    改下
    <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>
      

  12.   

    谢谢了,可以了,不过因为第一个表里有一个单元格里又嵌一个表,所以当其他都加10后,它却没动,四周的线框都出来了,很难看,该怎么办好呢

    <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>
      

  13.   

    有那位高手会做类似于:WWW.chinaedu.com(101远程教育网) 的网站,主要是在线视频播放(media player)和课件播放(MST Player) 我想做一个,有会的朋友请发邮件到:[email protected]  MSN:[email protected]
      

  14.   

    有那位高手会做类似于:WWW.chinaedu.com(101远程教育网) 的网站,主要是在线视频播放(media player)和课件播放(MST Player) 我想做一个,有会的朋友请发邮件到:[email protected]  MSN:[email protected]