http://faq.csdn.net/ListFAQ.aspx?roomid=304鼠标指向表格的渐变效果。
谢谢了

解决方案 »

  1.   

    <html>
    <head>
    <style type="text/css">
    * {
    font-size:12px;
    color:#666666;
    }
    #wc {
    width: 300px;
    /*border-left:#0099CC 1px dashed;
    border-right: #0099CC 1px dashed;*/
    border-bottom: #0099CC 1px dashed;
    border-collapse: collapse;
    }
    #wc td {
    border-top:#0099CC 1px dashed;
    text-align: center;
    height:25px;
    }
    #wc tr {
    background-color:#F7FBFF;
    }
    </style>
    <script type="text/javascript">
    var MColor = function (o) {
    var me = this;
    me.all = new Array; //存储预变化对象
    me.ing = false; //是否以在变化中
    me.rows = o.rows; //存储表格所有行
    me.max = 10; //设置变化次数
    me.min = 6; //设置变化值 (注:此项必须为num的倍数)
    me.num = 6; //设置经过和离开的倍数
    me.time = 10; //设置变化间隔时间
    };
    MColor.prototype = {
    IE : /MSIE/.test(window.navigator.userAgent),
    addEvent : function (a, b, c, d) {
    //添加事件
    if (a) {
    if (a.attachEvent)
    a.attachEvent(b[0], c);
    else if (a.addEventListener)
    a.addEventListener(b[1] || b[0].replace(/^on/, ""), c, d || false);
    }
    },reColor : function (o, b) {
    //获取颜色
    return o.bgColor ? o.bgColor :
    o.style.backgroundColor ? o.style.backgroundColor :
    b ? o.currentStyle.backgroundColor :
    document.defaultView.getComputedStyle(o, null).getPropertyValue("background-color");
    },toColor : function (c, b) {
    //颜色转化 返回Array
    if (b) {
    return "#" + [(c[0] < 16 ? 0 : "") + c[0].toString(16),
    (c[0] < 16 ? 0 : "") + c[1].toString(16),
    (c[0] < 16 ? 0 : "") + c[2].toString(16)].join("");
    } else{
    var a = c.match(/^(#)(.{2})(.{2})(.{2})$/) || c.match(/^(rgb)\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/),
    n = (a[1] == "#" ? 16 : 10);
    return [parseInt(a[2], n), parseInt(a[3], n), parseInt(a[4], n)];
    }
    },cing : function () {
    //操作所有对象
    var me = this, a = me.all, color, i;
    if (a.length > 0) {
    for (i = 0 ; i < a.length; i ++) {
    if (a[i].num < me.max) {
    color = me.toColor(a[i].exec(), true);
    a[i].style.backgroundColor = color;
    a[i].num ++;
    //$("show").innerHTML += color + "<br \/>";
    } else {
    a[i].inary = false;
    a.splice(i, 1);
    }
    }
    window.setTimeout(function () {
    me.cing();
    }, me.time);
    } else {
    me.ing = false;
    }
    },exec : function (b) {
    //控制对象变化
    var a = this.rgb, n = b || this.ing;
    a[0] = Math.max(0, Math.min(255, a[0] + n)),
    a[1] = Math.max(0, Math.min(255, a[1] + n)),
    a[2] = Math.max(0, Math.min(255, a[2] + n));
    return a;
    },over : function (o) {
    //鼠标经过
    var me = this, mod;
    if (o.ing > 0) {
    o.ing = -1 * me.min;
    o.num = me.max - o.num;
    mod = o.num % me.num;
    if (mod) o.exec(Math.abs(me.min / me.num * mod));
    o.num = Math.floor(o.num / me.num);
    //$("show").innerHTML += "<hr \/>";
    if (!o.inary) {
    me.all[me.all.length] = o;
    o.inary = true;
    o.num = 0;
    }
    if (!me.ing) {
    me.ing = true;
    me.cing();
    }
    }
    },out : function (o) {
    //鼠标离开
    var me = this;
    //$("show").innerHTML += "<hr \/>";
    if (o.ing < 0) {
    o.ing = me.min / me.num;
    o.num = me.max - o.num * me.num;
    if (!o.inary) {
    me.all[me.all.length] = o;
    o.inary = true;
    }
    if (!me.ing) {
    me.ing = true;
    me.cing();
    }
    }
    },init : function () {
    //初始化设置添加方法/事件
    var me = this, getFunction = function (o, f) {
    return function () {
    f.call(me, o);
    };
    }, i;
    for (i = 0 ; i < me.rows.length ; i ++) {
    me.rows[i].exec = me.exec;
    me.rows[i].inary = false;
    me.rows[i].ing = me.min;
    me.rows[i].rgb = me.toColor(me.reColor(me.rows[i], me.IE));
    me.addEvent(me.rows[i], ["onmouseover"], getFunction(me.rows[i], me.over));
    me.addEvent(me.rows[i], ["onmouseout"], getFunction(me.rows[i], me.out));
    }
    }
    };
    var $ = function (id) {
    return document.getElementById(id);
    };
    window.onload = function () {
    var wc = new MColor($("wc"));
    wc.init();
    };
    </script>
    <table id="wc">
    <tr><td>1</td></tr>
    <tr><td>2</td></tr>
    <tr><td>3</td></tr>
    <tr><td>4</td></tr>
    <tr><td>5</td></tr>
    <tr><td>6</td></tr>
    <tr><td>7</td></tr>
    <tr><td>8</td></tr>
    <tr><td>9</td></tr>
    </table>
    <div id="show"></div>
      

  2.   

    好象是meizz(梅花雪) 写的
    但是不知道为什么颜色改不了,一改就没有效果了。
      

  3.   

    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/System/Plugins/IE.js"></script>
    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/System/Global.js"></script>
    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/jsframework.js"></script>关键文件
      

  4.   

    to net_lover(【孟子E章】)
    钻石啊!!!!您说的三个文件,我都下了,并改了路径,不好使,[不知道为什么???]
      

  5.   

    我是从临时文件夹中一个个的copy出来的,真是不好使
      

  6.   

    它的代码
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta name="designer" content="csdn design team" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/jsframework.js"></script>
    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/System/Plugins/IE.js"></script>
    <script type="text/javascript" src="http://faq.csdn.net/ui/scripts/System/Global.js"></script>    <script type="text/javascript">
        Using("System.Web.Forms.MzBehavior");
        window.attachEvent("onload", function()
        {
            var rows = document.getElementById("FAQList").rows;
            for(var i=1; i<rows.length; i++)
                new MzBehavior.Highlight(rows[i], {backgroundColor: "#E0E0E0"});
        });
    </script>
    <style>
    #wrapper
    {
    text-align: center;
    }
    #innerWrapper
    {
    width: 770px;
    text-align: left;
    margin: auto;
    }
    #mainWrapper
    {
    }
    #pageContent
    {
    width: 100%;
    float: left;
    margin-right: -177px;
    }
    #innerContent
    {
    overflow: visible;
    margin-right: 177px;
    }
    #innerContent2
    {
    overflow: visible;
    }
    #sidebar
    {
    width: 170px;
    float: right;
    }
    li
    {
    line-height: 20px;
    }
    a
    {
    color: #000000;
    }
    .pagination
    {
    text-align: right;
    color: #9F4A25;
    padding: 3px 10px;
    }
    .pagination a
    {
    color: #9F4A25;
    }
    .pagination a.current
    {
    color: #FF0000;
    }/****** list *****/
    dd.list
    {
    margin: 3px 10px;
    }#FAQList th
    {
    height: 22px;
    color: #165B7E;
    font-weight: normal;
    background-color: #ECF2F5;
    border-top: solid 1px #95B8C9;
    border-bottom: solid 1px #95B8C9;
    }
    #FAQList td
    {
    height: 23px;
    border-bottom: dotted 1px #A6A6A6;
    }
    #FAQList td.c1
    {
    padding-left: 20px;
    background-position: 5px;
    background-repeat: no-repeat;
    background-image: url(index/dot1.gif);
    width: 495px;
    }
    #FAQList td.c2, #FAQList td.c2 a
    {
    color: #9F4A25;
    }
    #FAQList td.c3, #FAQList td.c3 a
    {
    color: #3C7693;
    }
    #FAQList td.c4
    {
    width: 65px;
    }
    #FAQList td.c5
    {
    color: #9F4A25;
    width: 25px;
    }#OwnerList th
    {
    height: 22px;
    color: #165B7E;
    font-weight: normal;
    background-color: #ECF2F5;
    border-top: solid 1px #95B8C9;
    border-bottom: solid 1px #95B8C9;
    }
    #OwnerList td
    {
    height: 23px;
    border-bottom: dotted 1px #A6A6A6;
    }
    #OwnerList td.c1
    {
    padding-left: 20px;
    background-position: 5px;
    background-repeat: no-repeat;
    background-image: url(index/dot1.gif);
    width: 570px;
    }
    #OwnerList td.c2, #OwnerList td.c2 a
    {
    color: #9F4A25;
    }
    #OwnerList td.c3, #OwnerList td.c3 a
    {
    color: #3C7693;
    }
    #OwnerList td.c4
    {
    width: 35px;
    }/********* faqContent **********/
    .faqContent
    {
    list-style-type: none;
    line-height: 18px;
    }
    .faqContent li
    {
    margin-top: 8px;
    margin-bottom: 8px;
    }
    .faqContent strong
    {
    color: #165B7E;
    }.faqContent .appraise
    {
    text-align: right;
    color: #165B7E;
    }
    .faqContent .appraise a
    {
    color: #165B7E;
    }
    .faqContent .appraise img
    {
    margin-left: 16px;
    }.faqContent .li1, .faqContent .li1 a
    {
    color: #FF4D00;
    }
    .faqContent .li2, .faqContent .li2 a
    {
    color: #9F4A25;
    }
    .faqContent .li3, .faqContent .li3 a
    {
    color: #9F4A25;
    }
    .faqContent .li3
    {
    border-bottom: solid 1px #95B8C9;
    }
    .faqContent .li4 p
    {
    margin-left: 32px;
    }/** listExpertFAQ **/
    #listExpertFAQ dl
    {
    padding: 1px;
    line-height: 20px;
    margin-bottom: 7px;
    border: solid 1px #95b8c9;
    }
    #listExpertFAQ dt
    {
    height: 28px;
    color: #165B7E;
    background: transparent url(index/bgContentPanelCaption.gif) repeat-x;
    }
    #listExpertFAQ dt strong
    {
    float: left;
    display: block;
    font-size: 12px;
    margin-top: 2px;
    padding-left: 22px;
    font-weight: normal;
    background: transparent url(index/panelicon.gif) no-repeat 5px 6px;
    }
    #listExpertFAQ dt span
    {
    float: right;
    display: block;
    margin-top: 6px;
    margin-right: 10px;
    }
    #listExpertFAQ ul
    {
    margin: 10px 10px 20px;
    }
    #listExpertFAQ li
    {
    color: #AAAAAA;
    }</style>
    </head>
      

  7.   

    <body>
    <table id="FAQList" border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <th>
    问题</th>
    <th>
    提交人</th>
    <th>
    回答人</th>
    <th>
    审核时间</th>
    <th>
    人气</th>
    </tr>
    <tr>
    <td class="c1">
        <a href='ListFAQ.aspx?roomid=304'
            title='JavaScript' target="_blank">
            【JavaScript】 </a><a href='read/212149.html'
                title='老问题,如何在客户端进行脚本验证80分' target="_blank">
                老问题,如何在客户端进行脚本验证80分
            </a>
    </td>
    <td class="c2">
        wuhuxia
    </td>
    <td class="c3">
        hbhbhbhb...
        &nbsp;
    </td>
    <td class="c4">
        2006-05-07
    </td>
    <td class="c5">
        221
    </td>
    </tr><tr>
    <td class="c1">
        <a href='ListFAQ.aspx?roomid=304'
            title='JavaScript' target="_blank">
            【JavaScript】 </a><a href='read/212142.html'
                title='鼠标与键盘信息测试' target="_blank">
                鼠标与键盘信息测试
            </a>
    </td>
    <td class="c2">
        xuzuning
    </td>
    <td class="c3">
        xuzuning
        &nbsp;
    </td>
    <td class="c4">
        2006-05-11
    </td>
    <td class="c5">
        255
    </td>
    </tr><tr>
    <td class="c1">
        <a href='ListFAQ.aspx?roomid=304'
            title='JavaScript' target="_blank">
            【JavaScript】 </a><a href='read/212025.html'
                title='&#215;&#215;&#215;&#215;如何在JS里改backgroundimage&#215;&#215;&#215;&#215;' target="_blank">
                &#215;&#215;&#215;&#215;如何在JS里改backgroundimage&#215;&#215;&#215;&#215;
            </a>
    </td>
    <td class="c2">
        brotherc...
    </td>
    <td class="c3">
        laochake
        &nbsp;
    </td>
    <td class="c4">
        2006-05-08
    </td>
    <td class="c5">
        292
    </td>
    </tr></table>     
    </body>
    </html>
      

  8.   

    这种极耗CPU的效果,也感兴趣?
    中国人的软件一直成不了什么气候,我知道原因了。看来都玩这种奇技淫巧惹的祸啊。
      

  9.   

    资源共享。
    ----------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="yixianggao" />
      <meta name="keywords" content="javascript" />
      <meta name="description" content="for csdn" />
      <script type="text/javascript" defer>
      <!--var arrTimerId = new Array();
    var numInterval = 1;function changePrimitiveColor(strPrimitiveColor, numStep)
    {
        if (strPrimitiveColor.length == 2)
        {
            var arrNumber = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
            var MAX_COLOR = 255;
            var numColor = parseInt(strPrimitiveColor, 16);
            numColor += numStep;
            if (numColor > MAX_COLOR)
            {
                numColor = 255;
            }        return arrNumber[Math.floor(numColor/16)] + arrNumber[numColor%16]
        }
    }function changeRowBgColor(numRowIndex, numStepR, numStepG, numStepB)
    {
        var row = document.getElementById("FAQList").rows[numRowIndex];
        var strColor = row.style.backgroundColor;
        if (strColor.length == 7)
        {
            var strR = changePrimitiveColor(strColor.substr(1, 2), numStepR);
            var strG = changePrimitiveColor(strColor.substr(3, 2), numStepG);
            var strB = changePrimitiveColor(strColor.substr(5, 2), numStepB);
            
            row.style.backgroundColor = "#"+strR+strG+strB;
            if (row.style.backgroundColor == "#ffffff")
            {
                window.clearInterval(arrTimerId[numRowIndex]);
                arrTimerId[numRowIndex] = null;
            }
        }
    }document.body.onload = function ()
    {
            var rows = document.getElementById("FAQList").rows;
            for(var i=0; i<rows.length; i++)
            {
                rows[i].onmouseover = function ()
                {
                    this.style.backgroundColor = "#ffcccc";
                    window.clearInterval(arrTimerId[this.rowIndex]);
                    arrTimerId[this.rowIndex] = null;
                };            rows[i].onmouseout = function ()
                {
                    if (arrTimerId[this.rowIndex] == undefined
                        || arrTimerId[this.rowIndex] == null)
                    {
                        arrTimerId[this.rowIndex] = window.setInterval("changeRowBgColor("+this.rowIndex+", 1, 1, 1)", numInterval);
                    }
                };
            }
    };  //-->
      </script>
     </head> <body>
      <table id="FAQList" border="1" width="100%">
        <tr>
            <td>1</td>
            <td>11</td>
            <td>111</td>
            <td>111</td>
        </tr>
        <tr>
            <td>2</td>
            <td>22</td>
            <td>222</td>
            <td>2222</td>
        </tr>
        <tr>
            <td>3</td>
            <td>33</td>
            <td>333</td>
            <td>3333</td>
        </tr>
        <tr>
            <td>4</td>
            <td>44</td>
            <td>444</td>
            <td>4444</td>
        </tr>
        <tr>
            <td>1</td>
            <td>11</td>
            <td>111</td>
            <td>111</td>
        </tr>
        <tr>
            <td>2</td>
            <td>22</td>
            <td>222</td>
            <td>2222</td>
        </tr>
        <tr>
            <td>3</td>
            <td>33</td>
            <td>333</td>
            <td>3333</td>
        </tr>
        <tr>
            <td>4</td>
            <td>44</td>
            <td>444</td>
            <td>4444</td>
        </tr>
        <tr>
            <td>1</td>
            <td>11</td>
            <td>111</td>
            <td>111</td>
        </tr>
        <tr>
            <td>2</td>
            <td>22</td>
            <td>222</td>
            <td>2222</td>
        </tr>
        <tr>
            <td>3</td>
            <td>33</td>
            <td>333</td>
            <td>3333</td>
        </tr>
        <tr>
            <td>4</td>
            <td>44</td>
            <td>444</td>
            <td>4444</td>
        </tr>
        <tr>
            <td>1</td>
            <td>11</td>
            <td>111</td>
            <td>111</td>
        </tr>
        <tr>
            <td>2</td>
            <td>22</td>
            <td>222</td>
            <td>2222</td>
        </tr>
        <tr>
            <td>3</td>
            <td>33</td>
            <td>333</td>
            <td>3333</td>
        </tr>
        <tr>
            <td>4</td>
            <td>44</td>
            <td>444</td>
            <td>4444</td>
        </tr>
      </table>
     </body>
    </html>