谁能帮我改一下 改成所有的滚动条都 单独记录自己的位置啊。。谢谢了。。 如下代码粘贴 一下就能看到效果。。<head runat="server">
    <title>无标题页</title>
    <style type="text/css">
    .testCSS
    {
    background: #99FFFF;
    height: 200px; 
    width: 200px; 
    float: left; 
    OVERFLOW: scroll ; 
    overflow-x: hidden ; 
    BACKGROUND-COLOR: transparent;
    scrollbar-face-color: #cccccc ; 
    scrollbar-highlight-color: #cccccc; 
    scrollbar-3dlight-color: #222222; 
    scrollbar-shadow-color: #cccccc; 
    scrollbar-darkshadow-color: #222222; 
    scrollbar-track-color: #222222; 
    scrollbar-arrow-color: #222222; 
    }
    </style>    <script language="javascript" type="text/javascript">
    ///cookie方法存scroll
        function SetCookie(sName, sValue)
         {
          var date = new Date();
          s = date.getDate();
          date.setDate(s+1);   //expire time is one month late!, and can't be current date!
          document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();
         }
         
         function GetCookie(sName)
         {
          // cookies are separated by semicolons
          var aCookie = document.cookie.split("; ");
          for (var i=0; i < aCookie.length; i++)
          {
          // a name/value pair (a crumb) is separated by an equal sign
          var aCrumb = aCookie[i].split("=");
          if (sName == aCrumb[0]) {
           return unescape(aCrumb[1]);}
          }
          
          // a cookie with the requested name does not exist
          return null;
         }               function fnLoad(uid)
         {
             var array = uid.match(/\d+\,/g)||[];
             for (var i=0; i<array.length; i++) 
             {
                 document.getElementById(array[i]).scrollLeft = GetCookie("scrollLeft");
                 document.getElementById(array[i]).scrollTop = GetCookie("scrollTop");
             }
         }         function fnUnload(uid)
         {
             SetCookie("UserId",uid);
             SetCookie("scrollLeft", document.getElementById(uid).scrollLeft);
             SetCookie("scrollTop", document.getElementById(uid).scrollTop);
         }
         
    </script></head>
<body onload="fnLoad('1,113,')">
    <form id="form1" runat="server">
        <div class="testCSS" id="1," onscroll="fnUnload('1,')">
            <table>
                <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>
                <tr>
                    <td>
                        10</td>
                </tr>
                <tr>
                    <td>
                        11</td>
                </tr>
                <tr>
                    <td>
                        12</td>
                </tr>
                <tr>
                    <td>
                        13</td>
                </tr>
                <tr>
                    <td>
                        14</td>
                </tr>
                <tr>
                    <td>
                        15</td>
                </tr>
                <tr>
                    <td>
                        16</td>
                </tr>
                <tr>
                    <td>
                        17</td>
                </tr>
                <tr>
                    <td>
                        18</td>
                </tr>
                <tr>
                    <td>
                        19</td>
                </tr>
                <tr>
                    <td>
                        20</td>
                </tr>
                <tr>
                    <td>
                        21</td>
                </tr>
                <tr>
                    <td>
                        22</td>
                </tr>
                <tr>
                    <td>
                        23</td>
                </tr>
                <tr>
                    <td>
                        24</td>
                </tr>
            </table>
        </div>
        <div class="testCSS" id="113," onscroll="fnUnload('113,')">
            <table>
                <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>
                <tr>
                    <td>
                        10</td>
                </tr>
                <tr>
                    <td>
                        11</td>
                </tr>
                <tr>
                    <td>
                        12</td>
                </tr>
                <tr>
                    <td>
                        13</td>
                </tr>
                <tr>
                    <td>
                        14</td>
                </tr>
                <tr>
                    <td>
                        15</td>
                </tr>
                <tr>
                    <td>
                        16</td>
                </tr>
                <tr>
                    <td>
                        17</td>
                </tr>
                <tr>
                    <td>
                        18</td>
                </tr>
                <tr>
                    <td>
                        19</td>
                </tr>
                <tr>
                    <td>
                        20</td>
                </tr>
                <tr>
                    <td>
                        21</td>
                </tr>
                <tr>
                    <td>
                        22</td>
                </tr>
                <tr>
                    <td>
                        23</td>
                </tr>
                <tr>
                    <td>
                        24</td>
                </tr>
            </table>
        </div>
    </form>
</body>

解决方案 »

  1.   


    function SetCookie(sName, sValue) { 
    var date = new Date(); 
    s = date.getDate(); 
    date.setDate(s+1); //expire time is one month late!, and can't be current date! 
    document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString(); 

    function GetCookie(sName) { 
    // cookies are separated by semicolons 
    var aCookie = document.cookie.split("; "); 
    for (var i = 0; i < aCookie.length; i++) { // a name/value pair (a crumb) is separated by an equal sign 
    var aCrumb = aCookie[i].split("="); 
    if (sName == aCrumb[0]) { 
    return unescape(aCrumb[1]);


    // a cookie with the requested name does not exist return null; 

    function fnLoad(uid) { 
    var array = uid.match(/\d+\,/g) || []; 
    for (var i = 0; i< array.length; i++) { 
    var v = GetCookie(array[i]);
    if(v) {
    v =v.split('|');
    document.getElementById(array[i]).scrollLeft = v[0]? v[0] : 0; 
    document.getElementById(array[i]).scrollTop = v[1]? v[1] : 0;


    }
    function fnUnload(uid) { 
    SetCookie(uid, document.getElementById(uid).scrollLeft + "|" + document.getElementById(uid).scrollTop); 

    </script>
      

  2.   

    danica7773
    让你费神了,谢谢你。。太感谢了。。我现在分不多了 要不肯定给你加!!!