Javascript 文件位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2901974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 02:24:57  来源:igfitidea点击:

document.location

javascripthtml

提问by Mitch Dempsey

How do you use document.location? Is it HTML or in JS? Please help me out!

你如何使用document.location?它是 HTML 还是 JS?请帮帮我!

采纳答案by loviji

documentis a DOM element. to access it you can use javascriptor dom api.

文档是一个 DOM 元素。要访问它,您可以使用javascriptdom api

回答by Mitch Dempsey

It is javascript.

它是javascript。

document.location.href="http://www.google.com";would redirect you go google

document.location.href="http://www.google.com";会重定向你去谷歌

回答by Pranay Rana

The JavaScript location object is a property of the window object. It can be used to control the web page displayed by the browser.

JavaScript location 对象是 window 对象的一个​​属性。它可用于控制浏览器显示的网页。

More methods and property : http://www.comptechdoc.org/independent/web/cgi/javamanual/javalocation.html

更多方法和属性:http: //www.comptechdoc.org/independent/web/cgi/javamanual/javalocation.html

reload() -The current window document is reloaded. If a value of true is passed to the reload function, the reload is forced to do an HTTP GET of the document. This is not normally done but is useful when you think the server contents may be different from your cache.

reload() - 重新加载当前窗口文档。如果将 true 值传递给重载函数,则重载将强制执行文档的 HTTP GET。这通常不会完成,但当您认为服务器内容可能与您的缓存不同时很有用。

replace(URL) -Requires a URL as a parameter. It loads the document at the URL on top of the current document. A new entry entry is not placed in the history object.

replace(URL) -需要一个 URL 作为参数。它在当前文档顶部的 URL 处加载文档。新条目条目未放置在历史记录对象中。