I often see people in Q group asking how to use js for page Jump. Today I am free to summarize the js jump code, hoping to help friends who need it.
(1) Direct jump between pages
Window. location. href = 'HTTP: // www.phpernote.com/windows-7/288.html ';
The specific usage is as follows:
<Input type = "button" onClick = "location. href = 'HTTP: // www.phpernote.com/php-function/416.html'"/>
There are several methods derived from this, such:
Window. navigate ('jump page URL address'); // note window. the navigate (sURL) method is for IE and does not apply to FF. In the html dom Window Object, windows are not listed at all. navigate this method. Therefore, you do not need to consider this method.
Self. location = 'jump page URL address ';
Top. location = 'jump page URL address'; // It is mainly used for page Jump within the framework.
(2) Open the page in a new window
Window. open ('HTTP: // www.phpernote.com/php-function/378.html ');
The specific usage is as follows:
<Input type = "button" onClick = "window. open ('HTTP: // www.phpernote.com/jquery-javasts/88.html')"/>
Note that the window. open action has many parameters. You can use various parameters to control the features of the new window. For example, whether the height, width, and size of the new window can be adjusted. I will not explain it here. If you need to know more, you can search in the search engine.
(3) return to the previous page
Window. history. back (-1 );
The specific usage is as follows:
<A href = "javascript: history. go (-1)"> return to the previous page </a>
(4) The js Code that automatically jumps to the page at regular intervals (in the following example, the page is automatically redirected to http://www.phpernote.com/php-function/463.html)
<script language="javascript" type="text/javascript"> setTimeout("javascript:location.href='http://www.phpernote.com/php-function/463.html'",3000);</script>
(5) Add the following code to the head label to automatically jump to the page at regular intervals.
<Meta http-equiv = "refresh" content = "5; url = http://www.phpernote.com/jquery-effects/114.html"/>
The above code means that 5 seconds after the page will automatically jump to the http://www.phpernote.com/jquery-effects/114.html page, although this does not belong to the js jump code, but it is also a page Jump method, note that this code must be added to the head label.
Articles you may be interested in
- Redirect PHP code from different cities by IP Address
- Summary of code for page timed jump (Countdown jump)
- Convert an Object to a String function code in js
- JavaScript copy function code, compatible with multiple browsers
- Common Javascript Verification Code collections such as js verification URLs
- Javascript shares the content with the code Summary of the websites on major social networking platforms
- PHP obtains the prvalue code of the website.
- Php uses regular expressions to filter various tags, spaces, and line breaks.