<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<table border="1">
  <tr height="20">
    <td onclick="checkthis()">22</td>
  </tr>
  <tr height="20">
    <td id="yincang" style="display:">22我要隐藏的内容</td>
   </tr>
</table>
<script language="javascript">
<!--
function checkthis()
{
yincang.style.display=(yincang.style.display=='none')? '':'none';
}
//-->
</script>
</body></html>

解决方案 »

  1.   

    <table>
      <tr>
        <td onclick="yincang.style.display = yincang.style.display=='none'?'':'none'">aa</td>
      </tr>
      <tr>
        <td id="yincang" style="display:'none'">我要隐藏的内容</td>
       </tr>
    </table>
      

  2.   

    很好,实现了效果。
    再次请问大侠:如果我不想用函数来实现,就直接写在onclick语句中呢?能实现吗?
      

  3.   

    <table>
      <tr>
        <td onclick="yincang.style.display=(yincang.style.display=='none')?'':'none'"></td>
      </tr>
      <tr>
        <td id="yincang" style="display:none">我要隐藏的内容</td>
       </tr>
    </table>