為什么行不隨著鼠標(biāo)的移動而改變背景顏色
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript">?
??
? ? ? window.onload = function(){
? ? ? ? ? ? ? ? ??
? ? ?// 鼠標(biāo)移動改變背景,可以通過給每行綁定鼠標(biāo)移上事件和鼠標(biāo)移除事件來改變所在行背景色。
? ? ? ? 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";
? ? ? ? ? ? }
? ? ? ? }
? ? ? ??
? ? ? // 編寫一個函數(shù),供添加按鈕調(diào)用,動態(tài)在表格的最后一行添加子節(jié)點(diǎn);
? ? ?
? ?
? ? ?
? ? ?// 創(chuàng)建刪除函數(shù)
? ? ?
? </script>?
2016-04-12
知道了,自己粗心