準備要寫一個在網頁上的工具列
試寫一下
<div id='my_toolbar' style='position:absolute;width:99%;height:50px;background-color:#666666;border:#cccccc 2px solid;margin:auto;'>ToolBar</div>
<script>
var toolbarobj = document.getElementById('my_toolbar');
window.onload = getScroll();
window.onscroll = getScroll();
function getScroll()
{
var t, l, w, h ,y,ny;
t = document.body.scrollTop;
h = document.body.scrollHeight;
y = document.body.clientHeight;
ny = y-55+t;
toolbarobj.innerHTML = t+' '+h+' '+y+' '+ny;
toolbarobj.style.top = parseInt(ny);
}
</script>
沒有留言:
張貼留言