鼠标放上去 行加高 4px 移开行高 减少 4px
 e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#cccccc',this.style.fontWeight='';alert(this.height);this.height = parseInt(this.height)+4;");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';this.height = parseInt(this.height)+4;");可是不行 
offsetHeight 好像不可以改变
哪位高手 支援下 谢谢

解决方案 »

  1.   

    onmouseover="this.style.height='80px'"
    http://topic.csdn.net/u/20091202/21/7a4acbf2-2103-4a11-abff-cf84095d5abf.html
      

  2.   

    var currTR=this;
        function overTR(){
        var trs = document.getElementById("setTbl").getElementsByTagName("tr");
        for(var i in trs){
            trs[i].onmouseover = function(){
            var oldBgColor=this.bgColor;
            var oldFontColor=this.style.color;
            this.bgColor = "#0000FF";
            this.style.color="#FFFFFF";
            if(currTR != this&&currTR.tagName=="TR"){currTR.bgColor = oldBgColor; currTR.style.color=oldFontColor;}
            currTR = this;
                }
            }
        }
        window.onload = function(){overTR();} 
      

  3.   

    onmouseover="this.style.height=this.style.height-4"
    这个倒是可以 可是FF不支持 IE7可以 
      

  4.   

    因为你GridView的row默认没有行高,所以取this.height就只能得到值"",parseInt("")是不行的。
    加一行代码:    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            //要先给height赋值
            e.Row.Attributes.Add("height", "50px");
            e.Row.Attributes.Add("onmouseover", 
                "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#cccccc';alert(this.height);this.height = parseInt(this.height)+4;");
        }
      

  5.   

    <table border="2">
    <tr height="100px" onmouseover="this.height = parseInt(this.height)+4;" onmouseout="this.height = parseInt(this.height)-4;">
    <td  >dfdfdf</td>
    </tr>
    </table>IE7支持 可是ff不支持
    我很郁闷ff
      

  6.   

               
     e.Row.Attributes.Add("onmouseover", "c=this.style.height;this.style.height='80px'");
                //当鼠标移开时还原高度
     e.Row.Attributes.Add("onmouseout", "this.style.height=c");