专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Javascript教程 » javascript拖拽:Javascript拖拽系列文章1的offsetParent属性 »正文

javascript拖拽:Javascript拖拽系列文章1的offsetParent属性

来源: 发布时间:星期四, 2008年12月25日 浏览:95次 评论:0
篇就先讲讲Javascript中offParent属性吧
支持浏览器:Internet Explorer 4.0+Mozilla 1.0+Netscape 6.0+Opera 7.0+Safari 1.0+
element.offParent
Summary
offParent s a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. If the element is non-positioned, the root element (html in standards compliant mode; body in quirks rendering mode) is the offParent. offParent s null when the element has style.display to "none".
Syntax
parentObj = element.offParent
Parameters
· parentObj is an object reference to the element in which the current element is off.
Specication
DOM Level 0. Not part of specication.
节选自Mozilla Developer Center网站WebSite
翻译如下:
element.offParent
整理总结
offParent属性返回个对象引用这个对象是距离offParent元素最近(在包含层次中最靠近)并且是已进行过CSS定位容器元素 如果这个容器元素未进行CSS定位, 则offParent属性取值为根元素(在标准兼容模式下为html元素;在怪异呈现模式下为body元素)引用 当容器元素style.display 被设置为 "none"时(译注:IE和Opera除外)offParent属性 返回 null
句法
parentObj = element.offParent
变量
· parentObj 是个元素引用当前元素偏移量在其中计算
规范标准
DOM Level 0. 并非规范标准部分.
点击运行可以看到效果: