<script type="text/javascript">
function indexOf(tdds,element)
{
for (var i = 0; i < tdds.length; i++)
{
if (tdds[i] == element)
{
return i;
}
}
}
function InitEvent()
{
var tds = document.getElementsByTagName("td");
for (var i in tds)
{
var td = tds[i];
td.onmouseover=function()
{
var index = indexOf(tds, this);
for (var j = 0; j <= index; j++) {
tds[j].innerText = "★";
}
for (var k = index + 1; k < tds.length; k++) {
tds[k].innerText = "☆";
}
}
}
}
</script>
</head>
<body onload="InitEvent();">
<table>
<tr><td>☆</td><td>☆</td><td>☆</td><td>☆</td><td>☆</td></tr>
</table>
</body>