การแสดงผลในตารางบนหน้า HTML ยังสามารถตั้งค่าให้เปลี่ยนส่วนสีของรหัสเมื่อเมาส์ถูกวางไว้บนเมาส์
คัดลอกรหัสรหัสดังนี้:
<script type = "text/javascript">
var currentactiverow;
// เปลี่ยนสีของเส้นที่เลือก
ฟังก์ชั่น ChangeCtiverow (OBJ) {
ถ้า (currentactiverow) {
currentactiverow.style.backgroundColor = "";
-
currentactiverow = obj;
currentactive.style.backgroundColor = "#f2f2f2";
-
</script>
จากนั้นตั้งค่า onmousehover หรือ onclick เหตุการณ์บน td เป็น onmouseover = "changectiverow (นี่)"