<button onclick="up()">up</button>
<iframe id="ofrm" height="300"></iframe>
<button onclick="down()">down</button>
<script type="text/javascript">
//<![CDATA[
var a = document.getElementById("ofrm").contentWindow.document;
a.open("text/html");
a.write("<div style='height:1000px'>never-online</div>");
a.close();
function up() {
a.body.scrollTop += 30;
}
function down() {
a.body.scrollTop -= 30;
}
//]]>
</script>
<iframe id="ofrm" height="300"></iframe>
<button onclick="down()">down</button>
<script type="text/javascript">
//<![CDATA[
var a = document.getElementById("ofrm").contentWindow.document;
a.open("text/html");
a.write("<div style='height:1000px'>never-online</div>");
a.close();
function up() {
a.body.scrollTop += 30;
}
function down() {
a.body.scrollTop -= 30;
}
//]]>
</script>
如果鼠标单击按钮时内容滚动的更快些。