作家
登录

Javascript拖拽系列文章1之offsetParent属性第1/3页

作者: 来源:www.28hudong.com 2013-03-30 02:56:06 阅读 我要评论

第一篇就先讲讲Javascript中的offsetParent属性吧。 支持的浏览器:Internet Explorer 4.0+,Mozilla 1.0+,Netscape 6.0+,Opera 7.0+,Safari 1.0+ element.offsetParent Summary offsetParent returns 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 offsetParent. offsetParent returns null when the element has style.display set to "none". Syntax parentObj = element.offsetParent Parameters · parentObj is an object reference to the element in which the current element is offset. Specification DOM Level 0. Not part of specification. 节选自Mozilla Developer Center网站 翻译如下: element.offsetParent 总结 offsetParent属性返回一个对象的引用,这个对象是距离调用offsetParent的元素最近的(在包含层次中最靠近的),并且是已进行过CSS定位的容器元素。 如果这个容器元素未进行CSS定位, 则offsetParent属性的取值为根元素(在标准兼容模式下为html元素;在怪异呈现模式下为body元素)的引用。 当容器元素的style.display 被设置为 "none"时(译注:IE和Opera除外),offsetParent属性 返回 null 。 句法 parentObj = element.offsetParent 变量 · parentObj 是一个元素的引用,当前元素的偏移量在其中计算。 规范 DOM Level 0. 并非规范的一部分. Untitled Document 测试OffsetParent属性 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

  推荐阅读

  javascript textarea支持图形编辑

这样的话稍微修改下,评论等简单的textarea的表情插入就可以直接显示出来了 而不是只显示emot了 比较实用 标题起的确切,但如果叫“现textarea支持编辑”似乎更废话 代码 New Document 我的logo:>>>详细阅读


本文标题:Javascript拖拽系列文章1之offsetParent属性第1/3页

地址:http://www.17bianji.com/kaifa2/JS/29397.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)