After my small job-hopping, I joined the current company in August 7. I seem to have joined the fire brigade and have not started to develop new modules, I have been implementing new requirements in the online module. Sometimes I really want to ask if some users are in the water or not. I just want to laugh at the demand... Fortunately, our sister, who is the project team, has a wealth of work experience and can coordinate well with users, which makes our developers not so hard ~ When users use the system, there will be a lot of form operations, but many forms are wrapped in a cloth, long ~ So we need a top button to return to the top of the page ~ Although there are many methods on the Internet, it is too cumbersome. It's too much trouble to judge and locate on the left ~ Previous code is used to save time, but we still need to consider it based on the system performance. In order not to put unnecessary pressure on browsers and servers, I decided to write a top button myself ~ Add the
<a id="_top"></a>
Add the js Code (implemented using div) at the end of <body> ):
<Script type = "text/javascript"> function form_top () {document. write ('<div id = "form_top"> <a href = "# _ top" title = "Back to top"> <div class = "top_img"> </div> </a> </div> ')} form_top (); </script>
Set the css style of the top button (so that the div is always in the bottom right corner of the page ):
#form_top{display:block; bottom:3px; right:3px; position:fixed;} .top_img{ background-image: url("img/top.png"); width: 40px; height:40px; cursor: pointer; }
Finally, do not forget to introduce the css style in the jsp page.