关于document使用的问题

qbfbi007 2009-12-13 10:09:24
最近本人在研究别人代码的时候,发现有些地方用到document这个对象,请问关于这个document一般用在什么地方?
难道是处理文件方面的吗?他有哪些方法?有谁能详细得跟我讲解下,谢谢了~
...全文
409 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
handsome_huxiulei 2009-12-13
  • 打赏
  • 举报
回复
up
sotom 2009-12-13
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 sotom 的回复:]
document 在使用 搜索引擎 lucene 的时候也存在 , 是把数据库表内容 或 其他文本内容 进行分词,存储为lucene自己的数据库 , 这个document就相当于lucene自己数据库的表。有些add 方法创建行 和列
[/Quote]

貌似楼主看到的是 JavaScript 的document ......不是 Java 里的document

如果是Javascript里边的document 那么这个document指的就是整个html页面 。 因为html页面是xml的子类。 所以html也是类似树形结构的 , 可以使用javascript 以访问xml的形式访问html .

document.getElementById()是访问节点效率最高的。
由于dom访问的方式是冒泡式遍历 所以也会出现 事件冒泡 用JavaScript处理事件时应当注意,取消事件冒泡在IE和firfox不同。

又啰嗦一堆。。。。。。
zhangfei2007cumt 2009-12-13
  • 打赏
  • 举报
回复
所有的HTML网页都可以看作一颗倒立的树来解析,也就是DOM(DOCUMENT OBJECT MODEL)。用的最多的方法就是document.getElementById(),document.getElementByTagNames()这两个方法。根据方法的名字就可以看出它们的作用就是分别根据ID或NAME来获取对应的元素。
sotom 2009-12-13
  • 打赏
  • 举报
回复
实际上这个document就是把数据组成表格的形式。
sotom 2009-12-13
  • 打赏
  • 举报
回复
document 在使用 搜索引擎 lucene 的时候也存在 , 是把数据库表内容 或 其他文本内容 进行分词,存储为lucene自己的数据库 , 这个document就相当于lucene自己数据库的表。有些add 方法创建行 和列
study999 2009-12-13
  • 打赏
  • 举报
回复
js
墨水鱼 2009-12-13
  • 打赏
  • 举报
回复
你说的应该是网页里面的吧,那个是javascript的document对象,指代那个网页的。具体解释(摘自javascript语言参考手册):

An HTML document consists of HEAD and BODY tags. The HEAD tag includes information on the document's title and base (the absolute URL base to be used for relative URL links in the document). The BODY tag encloses the body of a document, which is defined by the current URL. The entire body of the document (all other HTML elements for the document) goes within the BODY tag.
You can load a new document by setting the Window.location property.

You can clear the document pane (and remove the text, form elements, and so on so they do not redisplay) with these statements:

document.close();
document.open();
document.write(); You can omit the document.open call if you are writing text or HTML, since write does an implicit open of that MIME type if the document stream is closed.

You can refer to the anchors, forms, and links of a document by using the anchors, forms, and links arrays. These arrays contain an entry for each anchor, form, or link in a document and are properties of the document object.

Do not use location as a property of the document object; use the document.URL property instead. The document.location property, which is a synonym for document.URL, will be removed in a future release.
liuhong_20 2009-12-13
  • 打赏
  • 举报
回复
建议楼主看看 javascrpit编程艺术

或者搜下 w3cscholl 上面讲的比较详细
qbfbi007 2009-12-13
  • 打赏
  • 举报
回复
谢谢各位的回答,的确,在JS中document用得很多。
a21768541 2009-12-13
  • 打赏
  • 举报
回复
js里面呀,用document获取界面元素数据,还有一个windows对象
jingyinggong 2009-12-13
  • 打赏
  • 举报
回复
顶,主要用在js中

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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