window对象和document对象的区别
一般来讲,一个window里就是一个document,但是,iframe里面也可以装个document,在iframe里面就有区别了

alert(document.location === window.location); // true

不要混淆Window对象的location属性和Document对象的location属性。前者引用一个Location对象,而后者只是一个只
读字符串,并不具有Location对象的任何特性。document.location与document.URL是同义的,后者在
JavaScript1.1中是该属性的首选名称(因为这样避免了潜在的混淆)。在大多数情况下,document.location和
location.href是相同的。但是,当存在服务器重定向时,document.location包含的是已经装载的URL,而
location.href包含的则是原始请求的文档的URL。

document.location和window.location有什么区别就是
document你可以理解为文档,就是你的网页
window理解为窗口,就是你的ie浏览器包含的
无框架:简单的说,没有框架的情况下,是等同的
有框架:在有框架的情况下,最外层是相同的,在iframe里面的document.location和window.location不同的。
iframe里面的document.location 你看不ie地址变化,只改变iframe部分,
此时的window.location和top.location效果一致

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';//改变框架内容

一步一个脚印,方便自己复习,该出手时就出手,有错误,一定要指正,非常感谢,共同进步!

javascript -window与document 待整理的更多相关文章

  1. window.jQuery || document.write("<script src='__PUBLIC__/assets/js/jquery.js'>"+"<"+"/script>")

    今天无意中看到这样一段代码 <script type="text/javascript"> window.jQuery || document.write(" ...

  2. 客户端JavaScript(window、document、element)

    一.window对象是所有客户端JavaScript特性和API的主要接入点,用window来引用它. 属性:location属性(引用Location对象,当前显示在窗口的URL).document ...

  3. JavaScript常用内置对象(window、document、form对象)

    由于刚开始学习B/S编程,下面对各种脚本语言有一个宏观的简单认识. 脚本语言(JavaScript,Vbscript,JScript等)介于HTML和C,C++,Java,C#等编程语言之间.它的优势 ...

  4. javascript中window与document对象、setInterval与setTimeout定时器的用法与区别

    一.写在前面 本人前端菜鸟一枚,学习前端不久,学习过程中有很多概念.定义在使用时容易混淆,在此给向我一样刚踏入前端之门的童鞋们归纳一下.今天给大家分享一下js中window与document对象.se ...

  5. DOM Scripting -- Web Design with JavaScript and the Document Object Model 第2版 读书笔记

    1. childNodes  nodeValue <p id="p1">hello p!</p> alert(document.getElementById ...

  6. window、document、html、body、element的事件属性比较

    在分析jQuery的事件的时候有提到绑定事件的方式: Dean Edwards的跨浏览器事件绑定使用的方式是 element["on" + type] = handleEvent; ...

  7. JavaScript学习笔记及知识点整理_2

    1.一般而言,在Javascript中,this指向函数执行时的当前对象.举例如下: var someone = { name: "Bob", showName: function ...

  8. JavaScript window

    window -- window对象是BOM中所有对象的核心 window,中文"窗口" window对象除了是BOM中所有对象的父对象外,还包含一些窗口控制函数 全局的windo ...

  9. JavaScript window.open()属性

    一. Window 对象 Window 对象是 JavaScript 层级中的顶层对象. Window 对象代表一个浏览器窗口或一个框架. Window 对象会在 <body> 或 < ...

随机推荐

  1. Car-eye-http-flv-module 实现nginx-rtmp-mudule HTTP方式的FLV直播功能

    nginx-rtmp-mudule RTMP 是一款优秀的Car-eye-http-flv-module 是在nginx-rtmp-mudule RTMP基础上修改的流媒体服务器,除了支持flash播 ...

  2. java代码----------计算器代码

    总结: 很多不完善—— package com.rue; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.a ...

  3. 1006 Sign In and Sign Out (25)(25 分)思路:普通的时间比较题。。。

    1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...

  4. ESXI root密码忘记,重置root密码

    今天遇到了一个叫人比较头疼的问题,早在一个月前公司拉来一台服务器,闲着没事我给装成了Esxi的虚拟机系统了,时间过久忘了当时设定的密码为何?故而翻了许久的资料,终于找好的方向,准备重置系统密码.准备搞 ...

  5. mydumper 找不到libmysqlclient.so.20

    报错信息: mydumper: error while loading shared libraries: libmysqlclient.so.20: cannot open shared objec ...

  6. docker 学习(十) 容器常用命令

    1  docker run -it ubuntu:15.10 /bin/bash 如果有ubuntu:15.10这个镜像,就run,否则会从dockerhub下载,并run. -it 一般连用,表示按 ...

  7. HDU1257题解

    解题思路:这题的本质就是:求一个给定的数字序列中,非递增(或非递减)子序列的最少的条数. 思维误区:本题很容易被样例坑,以为是直接求跳跃点(i < j && ai < aj ...

  8. oracle 索引使用小结

    1. 普通索引 create index my_index on test (col_1); 可创建合并两列或多列的索引,最多可将32列合并在一个索引中(位图索引最多可合并30列) create in ...

  9. docker中部署mongodb副本集

    1.基本信息如下 服务器地址 192.168.73.129 副本集名称 rs 容器节点及端口映射         m0 37017:27017         m1 47017:27017       ...

  10. svn使用常用错误

    描述 :SVN更新提交显示文件被锁异常: Working copy XXXXXXXX locked Please execute "Cleanup" command 原因 : 待查 ...