<!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<input type="button" value="像素" onclick="aa()" /><input type="button" value="百分比" onclick="bb()" />
<div id="ddd" style="width:100%; height:100%;border:1px solid #000000;background:#cccccc;" ></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="100" border="1" cellspacing="1" cellpadding="1">
  <tr>
    <td id="point">i'm here</td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
<script>
document.body.onload=function(){
point.focus()
}
</script>

</body>
</html>

解决方案 »

  1.   

    前天看到一个帖子学的,IE下document.getElementById("abc").scrollIntoView()能直接跳到这个标签,但firefox就没试过了,另外,focus应该也行的,只是跳的位置不会那么准,不像猫那样直接滚动到元素为顶部的位置,锚应该是name="xxx"而不是id="xxx"吧。
      

  2.   

    莫非ie找不到name会用id替代?....我试过focus 真的很不准...只有在目标标签不再浏览器视野里面才会准  .....
      

  3.   

    scrollIntoView就准了,就不知除了IE其它支不支持