Home > Web Front-end > JS Tutorial > Location.href usage summary (most important)_Basic knowledge

Location.href usage summary (most important)_Basic knowledge

WBOY
Release: 2016-05-16 17:06:38
Original
1232 people have browsed it

There are many ways to use location.href in javascript, mainly as follows.

self.location.href="/url" The current page opens the URL page

location.href="/url" The current page opens the URL page

windows.location. href="/url" The current page opens the URL page. The first three usages are the same.

this.location.href="/url" Open the URL page on the current page

parent.location.href="/url" Open a new page on the parent page

top .location.href="/url" Open a new page on the top page

If the frame is customized on the page, you can replace the parent self top with the name of the customized frame. The effect is to open the url in the frame window. Address

In addition, window.location.href=window.location.href; and window.location.Reload() both refresh the current page. The difference lies in whether data is submitted. When data is submitted, window.location.Reload() will prompt whether to submit it. window.location.href=window.location.href; will submit the data to the specified url.

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