<style>
#btnTop { position:fixed; bottom:20px; right:20px; z-index:99; cursor:pointer; outline:none; border:none;
border-radius:6px; font-size:20px; color:white; padding:13px; background-color:#bd0000; }
#btnTop:hover { background-color:#404040; }
</style>
<button id="btnTop" onclick="butontop()" style="display:none;">Top</button>
<script>
function butontop() { document.body.scrollTop=0;
document.documentElement.scrollTop=0;
}
function onScroll() { if ( document.body.scrollTop > 800 || document.documentElement.scrollTop > 800 )
{ document.getElementById("btnTop").style.display="block"; }
else { document.getElementById("btnTop").style.display="none"; }
}
window.onscroll=function() { onScroll() };
</script>