可以写成chrome插件  在所有网站插入

js代码:

/*返回顶部 和返回底部*/
window.onload=function(){
	/*添加返回顶部按钮*/
	var a=document.createElement("a"); 
	a.setAttribute("href","JavaScript:window.scrollTo(0,0);"); 
	a.setAttribute("id","All_url_totop")
	a.setAttribute("class","All_url_totop");
	document.body.appendChild(a);
	/*添加返回底部的按钮*/
	var a=document.createElement("a");
	a.setAttribute("href","JavaScript:window.scrollTo(0,document.body.scrollHeight);"); 
	a.setAttribute("id","All_url_totop2")
	a.setAttribute("class","All_url_totop");
	document.body.appendChild(a);
}

css代码:

/*返回顶部的css*/
.All_url_totop{
position:fixed;right:10px;width: 35px;height: 35px; border-radius: 5px; position: fixed;right: 10px; cursor: pointer;background-repeat: no-repeat; background-position: 50% 50%; background-color: #000; opacity: .1; transition: opacity .2s ease-in-out;z-index: 99999;
}
#All_url_totop{
background-image:url(data:img/png;base64,R0lGODlhEgAUAJEAAAAAAP///////wAAACH5BAEAAAIALAAAAAASABQAAAImjI+py+IPo4xmWmRpyq5dFkzgoY3VY5KS9ykcKy6vnMEr3W417hQAOw==);
top:384px;
}
#All_url_totop2{
background-image:url(data:img/png;base64,R0lGODlhEgAUAJEAAAAAAP///////wAAACH5BAEAAAIALAAAAAASABQAAAIqlB2peX27nINKNsoswnrTLmABKJKcJH5PGl3siKZdabZgWN2rzuPv/yoAADs=);
top:429px;
}
#All_url_totop:hover,
#All_url_totop2:hover{
opacity: .5;
}