Home >Web Front-end >JS Tutorial >Recommended five methods for page jump using js_javascript skills
Recommended five methods for page jump using js
First type:
Second type:
Third type:
The fourth type:
The fifth type:
Summary:
self: current window object (if it is in an iframe, it is the window object of the frame)
top:parent window object
window: Typically, the browser will create a corresponding window object for each opened HTML. If this document contains multiple frames, the browser will create a window object for the original document, and then create a window object for each frame. Create additional window objects. You can use all properties, methods, and collections of window directly in the current window, that is, there is no need to add an expression in front that calculates the result to the current window object. Although window can be omitted, this keyword is generally used to facilitate reading and avoid some loopholes.
location: This object contains the current URL information and has multiple attributes. The default attribute is location.href, which represents the entire URL, that is, if location="http://www.jb51.net" is set, it is equivalent to location.href="http://www.jb51.net".self: current Window object (if it is in an iframe, it is the window object of the frame)
window.navigate("http://xx.html/") This method is only for IE and does not apply to other browsers such as Firefox. In the HTML DOM Window Object, window.navigate is not listed at all. method, so use this method as little as possible.
The window.location property is compatible with all browsers. Therefore, this is more commonly used when implementing page jumps.
window.history.go(-1) returns to the previous page
window.location.go(-1) is to refresh the previous page
The above recommendations for the five ways to implement page jumps in js are all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home more.