当我像这样聚焦 DOM 时,如何防止scrollTop
IE 发生变化?
<html>
<head>
<title>demo</title>
<script type="text/javascript">
function test() {
document.getElementById('div1').focus();
//document.body.scrollLeft = 0;
//document.body.scrollTop = 0;
}
</script>
</head>
<body onload="test()" scroll='no' style='overflow:hidden'>
<div id="div0" style="width:1400px;height:700px;background:#333333;position:absolute;"> </div>
<div id="div1" style="top:1500px;width:1500px;height:300px;background:#DDDDDD;position:absolute; "> </div>
</body>
</html>
我不想重置scrollTop=0
,因为它会使身体颤抖。