document和window的区别?

lfecnu 2003-09-26 11:13:28
哪位大侠能说说这两者的区别。
...全文
354 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
eliphe 2003-09-26
  • 打赏
  • 举报
回复
window指窗体
document指页面.

document是window的一个子对象.
wwwevil 2003-09-26
  • 打赏
  • 举报
回复
document和window是两个不同的对象
purexu 2003-09-26
  • 打赏
  • 举报
回复
document是window的一个子对象。window.document,因为window可以省略,所以一般只写document。
相似的还有window.history
thrillers 2003-09-26
  • 打赏
  • 举报
回复
window比document 高一层
wind0209 2003-09-26
  • 打赏
  • 举报
回复
object window
======
You can use the window object to retrieve information about the state of the window. You also can use this object to gain access to the document in the window, to the events that occur in the window, and to features of the browser that affect the window.

Typically, the browser creates one window object when it opens an HTML document. However, if a document defines one or more frames (that is, contains one or more FRAME or IFRAME tags), the browser creates one window object for the original document and one additional window object for each frame. These additional objects are child windows of the original window and can be affected by actions that occur in the original. For example, closing the original window causes all child windows to close. You can also create new windows (and corresponding window objects) using methods such as open, showModalDialog, and showModelessDialog.

You can apply any window property, method, or collection to any variable or expression that evaluates to a window object, regardless of how that window was created. Additionally, you can access all window properties, methods, and collections in the current window by using the property, method, or collection name directly—that is, without prefixing it with an expression that evaluates to the current window object. However, to help make more readable code and to avoid potential ambiguities, many authors use the window keyword when accessing window properties, methods, and collections for the current window. This keyword always refers to the current window.

Note Window property, method, and collection names are reserved keywords and cannot be used as the names of variables and routines.

The dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth, and returnValue properties are available only for windows created using the showModalDialog and showModelessDialog methods.
=======

object document
=======
Use the document object to retrieve information about the document, to examine and modify the HTML elements and text within the document, and to process events.

The document object is available at all times. Retrieve the object by applying the document property to a window or an element object. When used by itself, the document object represents the document in the current window.
================

61,125

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧