Home >Web Front-end >JS Tutorial >Attributes contained in the window.location object_javascript skills

Attributes contained in the window.location object_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:34:321138browse

hash//URL (anchor) starting with pound sign (#)

host//Host name and port number of the current URL

hostname//The host name of the current URL

href//Full URL

pathname//The path part of the current URL

port//Port number of the current URL

protocol//The protocol of the current URL

search//URL starting with question mark (?)

To use JS to locate anchor points, you can use window.hash with the element ID.

To use JS to capture the parameters of the page GET request, you can use window.location.search to obtain them, and then use the split method combined with looping to traverse the freely organized data format.

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