<div class="back-to-top" onclick="Top();return false;">top</div>
<script>
var timeOut;
function Top(){
if (document.body.scrollTop!=0||document.documentElement.scrollTop!=0){
window.scrollBy(0,-50);
timeOut=setTimeout('scrollToTop()',10);
}
else clearTimeout(timeOut);
}
</script>
<style>
.back-to-top {
position: fixed;
background: #9C27B0;
height: 20px;
width: 83px;
bottom: 135px;
right: 17px;
z-index: 9999;
box-shadow: 0 0 8px #cccccccf;
border-radius: 2px;
color:#ffffff;
line-height:20px;
text-align:center;
cursor: pointer;
}
</style>