為什么行不隨著鼠標的移動而改變背景顏色
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript">?
??
? ? ? window.onload = function(){
? ? ? ? ? ? ? ? ??
? ? ?// 鼠標移動改變背景,可以通過給每行綁定鼠標移上事件和鼠標移除事件來改變所在行背景色。
? ? ? ? var t=document.getElementsByTagName("tr");
? ? ? ? for(var i=0;i<t.length;i++)
? ? ? ? {
? ? ? ? ? ? change(t[i]);
? ? ? ? } ?
}
? ? ?function change(obj)
? ? ? ? {
? ? ? ? ? ? obj.onmouseover=function()
? ? ? ? ? ? {
? ? ? ? ? ? ? ? ob.style.backgroundColor="#000000";
? ? ? ? ? ? }
? ? ? ? ? ? obj.onmouseout=function()
? ? ? ? ? ? {
? ? ? ? ? ? ? ? ob.style.backgroundColor="#fff";
? ? ? ? ? ? }
? ? ? ? }
? ? ? ??
? ? ? // 編寫一個函數,供添加按鈕調用,動態在表格的最后一行添加子節點;
? ? ?
? ?
? ? ?
? ? ?// 創建刪除函數
? ? ?
? </script>?
2016-04-12
知道了,自己粗心