Home > Web Front-end > JS Tutorial > javascript page automatically refreshes only once_javascript tips

javascript page automatically refreshes only once_javascript tips

WBOY
Release: 2016-05-16 18:50:15
Original
1144 people have browsed it
1. Take a look at the following code
Copy the code The code is as follows:

<Script> <br>function reurl(){ <br>url = location.href; //Assign the address of the current page to the variable url <br>var times = url.split("?"); / /The delimiter symbol for splitting variable url is "?" <br>if(times[1] != 1){ //If the value after ? is not equal to 1, it means there is no refresh <br>url = "?1"; // Add the value of variable url to ?1 <br>self.location.replace(url); //Refresh the page<br>} <br>} <br>onload=reurl <br></script>

2. Principle
Make full use of the parameter options in the address bar and use scripts to obtain the parameters passed between pages without the support of background programs.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template