JavaScript问题:Window对象和多窗口浏览器。

12 views
Skip to first unread message

Cao Yi

unread,
Apr 27, 2008, 10:25:24 PM4/27/08
to 中国Ajax论坛
《JavaScript权威指南第五版》第13章第一节有说:
The Window object represents a web browser window (or a frame within a
window; in client-side JavaScript, top-level windows and frames are
essentially equivalent).

我有个疑问,Firefox和IE7+都支持多窗口(实际上是tab)浏览。那么,打开浏览器后,这些tab共有一个Window对象呢?还是每个
tab都有自己独立的Window对象?

谢谢先~~~

ZhangShen Peng(Uestc graduating...)

unread,
Apr 27, 2008, 10:27:59 PM4/27/08
to Aja...@googlegroups.com
1.单独的
2.对应firefox的插件
为什么呢?因为FireFox是多TAB的方式了(十分详细的说明我也没找到,就简单的看到这句)
可以这样取得当前tab

document.commandDispatcher.focusedWindow


2008/4/28 Cao Yi <iridi...@gmail.com>:

--
张沈鹏,在路上...
http://zsp.javaeye.com/

Cao Yi

unread,
Apr 27, 2008, 10:33:02 PM4/27/08
to Aja...@googlegroups.com
谢谢,请问"2.对应firefox的插件"怎么理解?

2008/4/28 ZhangShen Peng(Uestc graduating...) <zsp...@gmail.com>:

ZhangShen Peng(Uestc graduating...)

unread,
Apr 27, 2008, 10:34:47 PM4/27/08
to Aja...@googlegroups.com
可以把浏览器看为一个网页,
tab为其中的frame

2008/4/28 Cao Yi <iridi...@gmail.com>:

--
张沈鹏,在路上...
http://zsp.javaeye.com/

Cao Yi

unread,
Apr 27, 2008, 10:40:00 PM4/27/08
to Aja...@googlegroups.com
指南中有说Window对象和Document对象的区别。有说Document代表一个网页。
对你的比方,我的理解是:Window对tab关系,有似Document对其内部元素的关系。不知道对吗?
--
Best Regards,

       曹铱, Cáo Yī

ZhangShen Peng(Uestc graduating...)

unread,
Apr 27, 2008, 10:42:52 PM4/27/08
to Aja...@googlegroups.com
Window的类似的一个全局的作用域
与tab没有直接的对应关系

2008/4/28 Cao Yi <iridi...@gmail.com>:

--
张沈鹏,在路上...
http://zsp.javaeye.com/

Cao Yi

unread,
Apr 27, 2008, 10:47:04 PM4/27/08
to Aja...@googlegroups.com
嗯,谢谢。
我想这样看如何?
所谓多窗口浏览器,不过是把多个窗口放在一个框里而已。各个窗口还是有自己的Window的对象,和他们在不在一个框里显示与否没有任何关系。

ZhangShen Peng(Uestc graduating...)

unread,
Apr 27, 2008, 11:31:35 PM4/27/08
to Aja...@googlegroups.com

2008/4/28 Cao Yi <iridi...@gmail.com>:

--
张沈鹏,在路上...
http://zsp.javaeye.com/

Reply all
Reply to author
Forward
0 new messages