我认为你应该将onclick写在<td>中的文字上.

解决方案 »

  1.   

    你是这么写的么
    <td onclick="test()">hehe</td>
    如果不行的话,改成这样
    <span onclick="test()"><td>hehe</td><span>
      

  2.   

    我是这么写的
     <td class='ddd' id='aaa' onClick='javascript:test()></td>我试了一下 shijainbo兄所说的span方法,没有成功我基本上没有使用过javascript,html等方面东西,所以摸不着头脑了,呵呵
      

  3.   

    我测试是成功的:
    代码如下
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body>
    <table width="75%" border="1">
      <tr>
        <span onClick="javascript:alert('hehe')"><td>ddd</td></span>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>
      

  4.   

    哦,我觉得好像是这样子
    我的外层还有个<body onclick=ttt()></body>的东西
    然后在外层和内层之间有点不对劲的地方了