window.onscroll = function() { if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) { document.getElementById("scrollToTopButton").style.display = "block"; } else { document.getElementById("scrollToTopButton").style.display = "none"; } }; function scrollToTop() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; }