1 01.01.<head runat="server"> 2 02.02. <title></title> 3 03.03. <style type="text/css"> 4 04.04.#gotopbtn{position:absolute;top:expression(eval(document.documentElement.scrollTop + 350));} 5 05.05.</style> 6 06.06.<![endif]--> 7 07.07.<style type="text/css"> 8 08.08.body{ 9 09.09. font:12px Verdana, Geneva, sans-serif; 10 10.10. line-height:1.2; 11 11.11. text-align:center; 12 12.12.} 13 13.13.#gotopbtn { 14 14.14. width:20px; 15 15.15. height:100px; 16 16.16. background:#fff; 17 17.17. position:fixed; 18 18.18. bottom:100px; 19 19.19. right:330px; 20 20.20.display:none; 21 21.21. cursor:pointer; 22 22.22. font-size:14px; 23 23.23. line-height:30px; 24 24.24.} 25 25.25..main{ 26 26.26. width:50%; 27 27.27. height:1500px; 28 28.28. background-color:Green; 29 29.29. margin:0 auto; 30 30.30.} 31 31.31.</style> 32 32.32.</head> 33 33.33.<body> 34 34.34.<div class="main"></div> 35 35.35.<div id="gotopbtn">返回顶部</div> 36 36.36.<script type="text/javascript"> 37 37.37. idTest = document.getElementById('gotopbtn'); 38 38.38. idTest.onclick = function () { 39 39.39. document.documentElement.scrollTop = 0; 40 40.40. sb(); 41 41.41. } 42 42.42. window.onscroll = sb; 43 43.43. function sb() { 44 44.44. if (document.documentElement.scrollTop == 0) { 45 45.45. idTest.style.display = "none"; 46 46.46. } else { 47 47.47. idTest.style.display = "block"; 48 48.48. } 49 49.49. } 50 50.50.</script> 51 51.51.</body>