日期:2014-05-17  浏览次数:20718 次

javascript问题,求大神指导~~~!
JScript code

      function tbAdd(data_scroll,data_name,data_kind,data_qualit,data_dest,data_total,data_price,data_least,data_time,data_urlID){ 
           var tb = document.getElementById("dest_tb");
           rowIndex = tb.rows.length;
           var row = tb.insertRow(rowIndex);
           
           if(data_scroll%2==0)
                row.bgColor="#cccccc"
                
           var scroll = row.insertCell(0);
           scroll.width="50px";
           scroll.height="40px";
           if(data_urlID.length!=0)
                scroll.innerHTML = data_scroll;
           else
                scroll.innerHTML = "";
           scroll.style.fontSize ="14px";
           scroll.align="center";
           var name = row.insertCell(1);
           name.width="150px";
           name.innerHTML = data_name;
           name.style.fontSize ="14px";
           name.align="center";
           var kind = row.insertCell(2);
           kind.width="80px";
           kind.innerHTML = data_kind;
           kind.style.fontSize ="14px";
           kind.align="center";
           var qualit = row.insertCell(3);
           qualit.width="110px";
           qualit.innerHTML = data_qualit;
           qualit.style.fontSize ="14px";
           qualit.align="center";
           var dest = row.insertCell(4);
           dest.width="160px";
           dest.innerHTML = data_dest;
           dest.style.fontSize ="14px";
           dest.align="center";
           var total = row.insertCell(5);
           total.width="100px";
           total.innerHTML = data_total;
           total.style.fontSize ="14px";
           total.align="center";
           var price = row.insertCell(6);
           price.width="120px";
           price.innerHTML = data_price;
           price.style.fontSize ="14px";
           price.align="center";
           var least = row.insertCell(7);
           least.width="100px";
           least.innerHTML = data_least;
           least.style.fontSize ="14px";
           least.align="center";
           var time = row.insertCell(8);
           time.width="120px";
           time.innerHTML = data_time;
           time.style.fontSize ="14px";
           time.align="center";
           var url = row.insertCell(9);
           url.width="70px";
           if(data_urlID.length!=0)
                url.innerHTML = '<a href="#" onclick="location.href(\'detail.html?a=' + data_urlID + '\')">详细</a>';
           else
                url.innerHTML = "";
           url.style.fontSize ="14px";
           url.align="center";
           
           //row.innerHTML +='< onMouseOver = "test(this);" >';           
      } 


这个函数是为了向table ID为dest_tb的表里面加一行数据,现在想把每行的属性设置成鼠标移动到所在行时,背景变色,移出所在行时,颜色变回来,现在可以向里面插入一行数据,但是不会设置变色。
变色函数:
JScript code

      function ChangeOverCss(object) {
           object.style.background="#339900";
      }
      function ClearOverCss(object) {
           object.style.background="#00cc00";
      }


向这里插入数据
HTML code

<table border="0" id="dest_tb" width="990px" cellspacing="0" cellpadding="0">
            </table