contents.htm:
function setCookie(name,value)
{
var exp = new Date(); exp.setTime(exp.getTime() + 60*1000);
document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}
function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}
window.onbeforeunload = function()
{
setCookie("top", document.body.scrollTop);
}
window.onload = function()
{
var top = getCookie("top");
if(top) document.body.scrollTop = top;
}
function setCookie(name,value)
{
var exp = new Date(); exp.setTime(exp.getTime() + 60*1000);
document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}
function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}
window.onbeforeunload = function()
{
setCookie("top", document.body.scrollTop);
}
window.onload = function()
{
var top = getCookie("top");
if(top) document.body.scrollTop = top;
}
<body>
<span class="style2" style="color: #FFFFFF">
<b class=Outline style1 id=Out1 style="cursor: hand; ">Menu1</b>
</span>
<br>
<div id=Out1details style="display:None; position:relative; left:12;">
<table width="150">
<tr>
<td>
<u><a href=a.htm target=_parent>AAA</a></u><br>
<u><a href=b.htm target=_parent>BBB</a></u><br>
</td></tr>
</table>
</div>
<br> <span class="style2" style="color: #FFFFFF">
<b class=Outline style1 id=Out2 style="cursor: hand; ">Menu2</b>
</span>
<br>
<div id=Out2details style="display:None; position:relative; left:12;">
<table width="150">
<tr>
<td>
<u><a href=c.htm target=_parent>CCC</a></u><br>
<u><a href=c.htm target=_parent>DDD</a></u><br>
</td></tr>
</table>
</div>
<br> <span class="style2" style="color: #FFFFFF">
<b class=Outline style1 id=Out3 style="cursor: hand; ">Menu3</b>
</span>
<br>
<div id=Out3details style="display:None; position:relative; left:12;">
<table width="150">
<tr>
<td>
<u><a href=e.htm target=_parent>EEE</a></u><br>
<u><a href=f.htm target=_parent>FFF</a></u><br>
</td></tr>
</table>
</div>
<br> <span class="style2" style="color: #FFFFFF">
<b class=Outline style1 id=Out4 style="cursor: hand; ">Menu4</b>
</span>
<br>
<div id=Out4details style="display:None; position:relative; left:12;">
<table width="150">
<tr>
<td>
<u><a href=g.htm target=_parent>GGG</a></u><br>
<u><a href=h.htm target=_parent>HHH</a></u><br>
</td></tr>
</table>
</div>
<br>
<script language=JavaScript>
function clickHandler() {
var targetId, srcElement, targetElement;
srcElement = window.event.srcElement;
if (srcElement.className == "Outline") {
targetId = srcElement.id + "details";
if(targetId!="Out1details"){
targetElement = document.all("Out1details");
targetElement.style.display = "none";}
if(targetId!="Out2details"){
targetElement = document.all("Out2details");
targetElement.style.display = "none";}
if(targetId!="Out3details"){
targetElement = document.all("Out3details");
targetElement.style.display = "none";}
if(targetId!="Out4details"){
targetElement = document.all("Out4details");
targetElement.style.display = "none";}
targetElement = document.all(targetId);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
}
window.scroll(0,0);
}
}document.onclick = clickHandler;
</script>可每次键入链接这个contents.htm页面内容就自动回到顶端,并且里面的菜单就自动收起来了,看不见自己刚才点击的是哪个链接。
请问,有什么办法吗?谢谢各位!!!