document.location 与document.URL有什么区别?

来源:百度知道 编辑:UC知道 时间:2024/06/04 23:15:44
document.location 与document.URL有什么区别?能举例子说明最好了。

document.location="url";(只读)
document.location.reload("url";);
window.location="url";
location="url";
document.href="url"
document.location.href="url"
document.location.replace="url"
document.action="url"; document.submit();

document.location.href和document.location.replace都可以实现从A页面切换到B页面,但他们的区别是:
用document.location.href切换后,可以退回到原页面。而用document.location.replace切换后,不可以通过“后退”退回到原页面。
关于document.location.href或其他可回退的切换方式
document.location 相当于 document.URL 声明了装载文档的URL,
除非发生了服务器重定向, 否则该属性的值与Window.location.href的值是一样的.

history.go(-1);//返回上一页
document.IFRAME名称.location.href='url';//改变框架内容