<HEAD>
</HEAD>
<BODY>
<table id="mytable" width=50% style="border:1px solid #000">
</table>
</BODY>
</HTML>
<script lanage="javascript">
var table = document.getElementById("mytable")
var tr
tr = table.insertRow(0)
tr.height=25
tr.onclick=function(){
alert("tr created!")
}
tr.insertCell()
</script>
循环所有行,给每行添上这两个事件。每一行都用一个<a></a>
然后写<a>的CSS
<style type="text/css">
<!--
a.tra : hover {color: #FF00FF}
-->
</style>
<table width="200" border="0">
<tr><a class="tra">
<td style="">efdsfaf</td>
<td>dsfdfa</td></a>
</tr>
<tr><a class="tra" >
<td>sdfsaf</td>
<td>dfasdfsdf</td></a>
</tr>
</table>