1 <!doctype html>
  2 <html>
  3 <head>
  4     <meta charset="utf-8">
  5     <title>网站首页</title>
  6     <style>
  7 #top{
  8     border:1px solid gray;
  9     padding:5px;
 10     height:50px;
 11     width:50px;
 12     line-height:50px;
 13     position:fixed;
 14     right:5px;
 15     top:400px;
 16     text-align:center;
 17     display:none;
 18     }
 19 #top:hover{
 20     color:red;
 21     cursor:pointer;
 22 }
 23     </style>
 24 </head>
 25 
 26 <body>
 27 <div id="top">top</div>
 28 asdf<br>
 29 asdfas<br>
 30 asdf<br>
 31 asdfas<br>
 32 asdf<br>
 33 asdfas<br>
 34 asdf<br>
 35 asdfas<br>
 36 asdf<br>
 37 asdfas<br>
 38 asdf<br>
 39 asdfas<br>
 40 asdf<br>
 41 asdfas<br>
 42 asdf<br>
 43 asdfas<br>
 44 asdf<br>
 45 asdfas<br>
 46 asdf<br>
 47 asdfas<br>
 48 asdf<br>
 49 asdfas<br>
 50 asdf<br>
 51 asdfas<br>
 52 asdf<br>
 53 asdfas<br>
 54 asdf<br>
 55 asdfas<br>
 56 asdf<br>
 57 asdfas<br>
 58 asdf<br>
 59 asdfas<br>
 60 asdf<br>
 61 asdfas<br>
 62 asdf<br>
 63 asdfas<br>
 64 asdf<br>
 65 asdfas<br>
 66 asdf<br>
 67 asdfas<br>
 68 asdf<br>
 69 asdfas<br>
 70 asdf<br>
 71 asdfas<br>
 72 asdf<br>
 73 asdfas<br>
 74 asdf<br>
 75 asdfas<br>
 76 asdf<br>
 77 asdfas<br>
 78 asdf<br>
 79 asdfas<br>
 80 asdf<br>
 81 asdfas<br>
 82 asdf<br>
 83 asdfas<br>
 84 asdf<br>
 85 asdfas<br>
 86 asdf<br>
 87 asdfas<br>
 88 asdf<br>
 89 asdfas<br>
 90 asdf<br>
 91 asdfas<br>
 92 asdf<br>
 93 asdfas<br>
 94 asdf<br>
 95 asdfas<br>
 96 asdf<br>
 97 asdfas<br>
 98 asdf<br>
 99 asdfas<br>
100 asdf<br>
101 asdfas<br>
102 asdf<br>
103 asdfas<br>
104 asdf<br>
105 asdfas<br>
106 asdf<br>
107 asdfas<br>
108 asdf<br>
109 asdfas<br>
110 asdf<br>
111 asdfas<br>
112 asdf<br>
113 asdfas<br>
114 asdf<br>
115 asdfas<br>
116 asdf<br>
117 asdfas<br>
118 asdf<br>
119 asdfas<br>
120 asdf<br>
121 asdfas<br>
122 asdf<br>
123 asdfas<br>
124 asdf<br>
125 asdfas<br>
126 asdf<br>
127 asdfas<br>
128 asdf<br>
129 asdfas<br>
130 asdf<br>
131 asdfas<br>
132 asdf<br>
133 asdfas<br>
134 asdf<br>
135 asdfas<br>
136 asdf<br>
137 asdfas<br>
138 asdf<br>
139 asdfas<br>
140 asdf<br>
141 asdfas<br>
142 asdf<br>
143 asdfas<br>
144 asdf<br>
145 asdfas<br>
146 asdf<br>
147 asdfas<br>
148 asdf<br>
149 asdfas<br>
150 asdf<br>
151 asdfas<br>
152 asdf<br>
153 asdfas<br>
154 asdf<br>
155 asdfas<br>
156 asdf<br>
157 asdfas<br>
158 </body>
159 </html>
160 <script>
161 //单击向下滚动,单击停止滚动
162 //var f=true;
163 //var t;
164 //document.body.onclick=function(){
165     //if(f){
166     //t=setInterval(function(){document.title=document.body.scrollTop++;},20);
167     //f=false;
168     //}else{
169      //clearInterval(t);
170      //f=true;
171 //    }
172 //}
173 //下拉显示top,点击top返回顶部
174 var tt=document.getElementById('top');
175 tt.onclick=function(){
176     document.body.scrollTop=0;
177 }
178 window.onscroll =function(){
179 document.title=document.body.scrollTop;
180 if(document.body.scrollTop>500){
181     tt.style.display='block';
182     }else{
183         tt.style.display='none'
184     }
185 }
186 //window.onscroll=function(){
187     //document.title=document.body.scrollTop;}
188 </script>

 

Copyright © 2024 小蕊同学
Powered by .NET 9.0 on Kubernetes