<html>
<head>
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</head>
<body><table id=tb>
<tr id=row>
<td id=col>11111</td>
</tr>
</table>
<script language=javascript>
    document.getElementById("tb").rows(0).onclick = "alert(1);";
</script>
</body>
</html>

解决方案 »

  1.   

    如果是这样的话,那么点击这第一行的时候,不会alert出来
      

  2.   

    <html>
    <head>
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </head>
    <body><table id=tb>
    <tr id=row onclick="alert('1')">
    <td id=col>11111</td>
    </tr>
    </table>
    </body>
    </html>
      

  3.   

    <html>
    <head>
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </head>
    <body><table id=tb>
    <tr id=row>
    <td id=col>11111</td>
    </tr>
    </table>
    <script language=javascript>
        document.getElementById("tb").rows(0).onclick = function(){alert(1);};
    </script>
    </body>
    </html>应该这样
    onclick必须赋给一个函数的值:function(){alert(1);}
    你那是字符串。