$ID(“Show”).scrollTop=1000000; 这个常用来拿来滚屏的,特别是聊天的显示区。但是在安卓的webview里失效了,真奇怪
<!DOCTYPE html>
<meta charset=“utf-8” />
<title>WebSocket Test</title>
<div id=“Show” style=“width:100%;padding:5px;overflow-y:scroll;height:300px;border:solid 1px #cccccc;background-color:white;”> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1234</div> <div>1</div> <div>1</div> <div>1</div> <div>1</div> <div>1</div> <div>1</div> </div>
<div id=“Send” style=“width:100px;height:50px;border:solid 1px red;”>测试滚动</div>
<script language=“javascript” type=“text/javascript”>
function $ID(obj){ return document.getElementById(obj);} $ID(“Send”).addEventListener(‘touchstart’, function (e) { //alert(123); $ID(“Show”).scrollTop=1000000; //这个在其他浏览器里正常能滚屏到最下端的 //$ID(“Show”).scrollTop=$ID(“Show”).scrollHeight; });
</script>
</html>