search
HomeWeb Front-endJS TutorialJS refreshes the page sum! Various JS refresh page codes!

1)

10 means refreshing every 10 seconds
2)

If you want to refresh an iframe, replace window with the name or ID number of the frame
3)

4>

function abc()
{
window.location.href="/blog/window.location.href ";
setTimeout("abc()",10000);
}

Refresh this page:
Response.Write("

Refresh the parent page:
Response.Write("")

Go to the specified page:
Response.Write("")

Summary of refresh page implementation (HTML, ASP, JS)
'by aloxy

Refresh regularly:
1,<script>setTimeout("location.href='url'",2000)</script>

Explanation: url is the URL address of the page to be refreshed
2000 is the waiting time = 2 seconds,

2,

Explanation:
n is the number of seconds to wait before loading the specified URL.
url is an absolute URL to be loaded.
n, is the waiting time, in seconds
url is the URL address of the page to be refreshed

3,

Note: Generally, a url parameter or form is used to pass The value is used to determine whether an operation has occurred, and then refreshed using response.redirect.

4. Refresh the frame page
〈script language=javascript>top.leftFrm.location.reload();parent.frmTop.location.reload();〉

The problem of refreshing the form after it pops up


Response.Write("<script>window.showModalDialog('../OA/SPCL.aspx',window,'dialogHeight: 300px; dialogWidth: 427px; dialogTop: 200px; dialogLeft: 133px')</script>> ;");//open
    Response.Write("<script>document.location=document.location;</script>");

Add

The refreshed content is added to if (!IsPostBack)

Refresh the left side on the right side of the frame page
//Refresh the left half of the frame page
Response.Write("");


There are three ways to implement the page scheduled refresh function

Method:
1, set in html:

xxxxx and then add the following line!
Scheduled refresh:
10 represents the refresh interval, in seconds

2.jsp

Refresh every second

3. Use javascript:


The page automatically jumps:
1, set in html:

xxxxx and then add the following line!
Re timed jump and refresh: ,
The 20th finger will jump to http:// after 20 seconds. own URL page.


Click the button to submit the form and refresh the upper-level window

A window opens B window

Then submit data in B to C window

Finally, refresh A window

and close B window

Several javascript functions

//The first window to automatically close

//The second function to refresh the parent page


//The third open window

js refresh the parent page

Non-modal refresh the parent page: window.opener.location.reload();
Modally refresh the parent page: window.dialogArguments.location.reload();

Response.Write(""); //Close the script block
}
Above The code is the code to close the dialog box and refresh the parent page. This code can also be written directly into the html of editdata.aspx, and then called in the background cs

<script> <br/><!--</script>

var limit="0:10"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh (){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec =parselimit%60
if (curmin!=0)
curtime=curmin+"minute"+cursec+"Refresh this page in seconds!"
else
curtime=cursec+"Refresh this page in seconds!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh
file://-->

Several ways to refresh the page using Javascript:

1 history .go(0)

2 location.reload()

3 location=location

4 location.assign(location)

5 document.execCommand('Refresh')

6 window.navigate(location)

7 location.replace(location)

8 document.URL=location.href

How to automatically refresh the page:

1. Automatic page refresh: add the following code to the

area

The 20 refers to refreshing the page every 20 seconds.

2. The page automatically jumps: add the following code to the

area

The 20th finger will jump to the http://www.wyxg.com page after 20 seconds

3. The page automatically refreshes the js version

function myrefresh()

{

                                                                                                                                                                                               ',1000); //Specify a refresh time of 1 second

JS script statement to refresh the frame

//How to refresh the page containing the frame using

parent.location.reload();

//The child window refreshes the parent window

self.opener.location.reload();

script>

(orrefresh )

//How to refresh the page of another frame using

parent .Another FrameID.location.reload();

If you want to refresh when the window is closed or you want to refresh when the window is opened, just call the following statement in

.

Refresh when the window is open

Refresh when the window is closed

window.opener.document.location.reload()

[JS] Let the page automatically refresh only once http://hi.baidu.com/lwlfree/blog/item/9a1ae024a41dd50b4c088ddd.html

I am currently working on a module, which uses tabs. After comparison, I decided to use the TAB function in the JQuery UI plug-in.

Although JQ's TAB has a function of directly reading pages, it is generally read according to UTF-8 encoding. Therefore, if you want to reuse the previous page and load it into TAB, a large amount of source code will appear. Finally, it was decided that the TAB should not read the application page directly, but only read the transfer page (IFRAME is used in the transfer page to load the application page), so as to achieve the function of dynamically loading the application page when switching TAB.

However, after using IFRAME, I found that in order to make the application page and the TAB frame page integrated, IFRAME must be able to adapt to the height of the application page. Although JS is used to make the IFRAME adapt to the height of the internal page, when the application page When the frame is loaded almost at the same time, the height of the IFRAME still cannot be adapted, but when the page inside the IFRAME is refreshed, the height can be adapted.

From this I came up with the idea of ​​delayed refresh of the page, but when I only used setTimeout("window.location.reload();",500) to implement it, I found that the page would keep refreshing. The reason is: delayed refresh After that, the page is reloaded and setTimeout thinks it is the first time the page is loaded, so it will be refreshed continuously.

Finally, the problem was solved by using the following code:

function reurl(){

url = location.href; //Assign the address of the current page to the variable url

var times = url.split ("$"); //The delimiter of the variable url is "$"

if(times[1] != 1){ //If the value after $ is not equal to 1, it means there is no refresh

url += " &$1"; //Add the value of the variable url to $1

​​​​​ self.location.replace(url); //Refresh the page

​​ }
}

window.onload = function () { setTimeout("reurl(); ",500) }

The above JS code can be used for URLs with GET parameters.



More JS refresh page sum! Various JS refresh page codes! Please pay attention to the PHP Chinese website for related articles!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript: Exploring the Versatility of a Web LanguageJavaScript: Exploring the Versatility of a Web LanguageApr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The Evolution of JavaScript: Current Trends and Future ProspectsThe Evolution of JavaScript: Current Trends and Future ProspectsApr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

Demystifying JavaScript: What It Does and Why It MattersDemystifying JavaScript: What It Does and Why It MattersApr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Is Python or JavaScript better?Is Python or JavaScript better?Apr 06, 2025 am 12:14 AM

Python is more suitable for data science and machine learning, while JavaScript is more suitable for front-end and full-stack development. 1. Python is known for its concise syntax and rich library ecosystem, and is suitable for data analysis and web development. 2. JavaScript is the core of front-end development. Node.js supports server-side programming and is suitable for full-stack development.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft