Back to top

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.