这个用不到JavaScript的吧?
直接用锚就轻松搞定问题了呀:
链接页面:
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>链接页面</title>
</head>
<body>
<a target="_blank" href="index.html#a">a</a>
<a target="_blank" href="index.html#b">b</a>
<a target="_blank" href="index.html#c">c</a>
<a target="_blank" href="index.html#d">d</a>
<a target="_blank" href="index.html#e">e</a>
</body>
</html>
index页面(也就是那个内容比较多,想要直接定位的页面):
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>分页面</title>
</head>
<body>
</body>
<div style="height:500px background:#CCC" id="a">aaa</div>
<div style="height:500px background:#DDD" id="b">bbb</div>
<div style="height:500px background:#EEE" id="c">ccc</div>
<div style="height:500px background:#ccc" id="d">ddd</div>
<div style="height:500px background:#ddd" id="e">eee</div>
<div style="height:500px background:#eee" id="f">fff</div>
</html>
<script type="text/javascript">window.onload=setTimeout(function(){
window.scrollTo(0,500) //修改500为指定高度
},5)
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)