JavaScript frames 对象

frames -- frames用于表现HTML页面当前窗体的中的框架集合
  • frames,中文"框架"的意思
  • 引用网址:http://www.dreamdu.com/javascript/window.frames/
  • frames对象是window对象的属性
  • 如果页面使用框架,将产生一个框架集合frames,在集合中可用数字(从0开始,从左到右,逐行索引)或名字索引框架。

框架集引用中使用的对象

框架集引用中使用的对象
window 当前框架
top 最顶层的框架,就是浏览器窗体
parent 包含当前框架的父框架
self 当前框架,总是等于window对象
<frameset rows="20%, *, 20%">
        <frame src="http://www.dreamdu.com/javascript/exe_window.frames.top/" name="top" />
        <frameset cols="20%, *">
                <frame src="http://www.dreamdu.com/javascript/exe_window.frames.top/" name="left" />
                <frame src="http://www.dreamdu.com/javascript/exe_window.frames.right/" name="right" />
        </frameset>
        <frame src="http://www.dreamdu.com/javascript/exe_window.frames.top/" name="bottom" />
</frameset>

上面的框架页示例产生了一个框架集

window与self代表相同的对象,但是self是为了确定正在使用的框架不是parent,而是自身,top对象代表最顶层框架,浏览器窗体本身,因此在这个例子中就等于window对象,如果页面上没有框架,window,self都等于top,并且框架集合的长度为0

如果框架名称为right的页面包括下面框架:

<frameset cols="50%, *">
        <frame src="http://www.dreamdu.com/javascript/exe_window.frames.top/" name="righttop" />
        <frame src="http://www.dreamdu.com/javascript/exe_window.frames.top/" name="rightbottom" />
</frameset>

那么righttop与rightbottom的parent父框架为right

JavaScript frames 对象示例 -- 可以尝试编辑



  • 教程中有什么不懂的地方?发现教程的错误!对教程有什么建议!快快给我留言呀 给猴子留言,我会尽快解答你的问题:)