Ways to refresh Web pages using JavaScript

Source: Internet
Author: User
Tags time interval

This article mainly introduces the use of JavaScript to refresh the Web page, is JS is commonly used to achieve one of the most basic functions, the need for friends can refer to the

You can use the JavaScript Location.reload method to refresh a Web page. When the user clicks on a link this code can be invoked automatically in an event.

If you want to use the mouse to click to refresh the page, you can use the following code:

?

1 <a href= "Javascript:location.reload (True)" >refresh page</a>

To get a better idea of it, you can refresh the page

Automatic refresh:

You can also refresh the page by automatically using JavaScript for a given time period. The following is an example of refreshing this page every 5 seconds. Can change this time according to your request.

?

1 2 3 4 5 6 7 8 9 10 11 12 13-14

The settimeout () here is a built-in JavaScript function that can be used to execute another function after a given time interval.

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.