<SCRIPT LANGUAGE="JavaScript">
<!--
/*haiwa@2004-02-12*/
function Trim(strValue)
{
return strValue.replace(/^\s*|\s*$/g,"");
}
function SetCookie(sName, sValue)
{
document.cookie = sName + "=" + escape(sValue);
}
function GetCookie(sName)
{
var aCookie = document.cookie.split(";");
for (var i=0; i < aCookie.length; i++)
{
var aCrumb = aCookie[i].split("=");
if (sName == Trim(aCrumb[0]))
{
return unescape(aCrumb[1]);
}
}
return null;
}
function scrollback()
{
if (GetCookie("scroll")!=null){document.body.scrollTop=GetCookie("scroll")}
}
//-->
</SCRIPT>
然后修改BODY位置为
<BODY id=body onscroll=SetCookie("scroll",body.scrollTop); onload="scrollback();">
代码如下:
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)