parentNode当前元素的父节点,无兼容问题。
offsetParent是定位父级,与定位有关
1. 如果当前元素设置为position:fixed,那么offsetParent=null
但是firefox的offsetParent是body
2. 如果父级元素设置position定位,那么offsetParent就是最近的设置定位的父级
3. 如果父级元素都没有设置position定位,那么offsetParent是body
4. body的offsetParent=null
5. td内部的元素的offsetParent是td
6. td,tr的offsetParent是table
7. option的offsetParent=null
8. li的offsetParent是body
IE5.5,6,7下:
1. 如果当前元素有定位(非fixed),且父级无定位,那么offsetParent是html2. 如果当前元素无定位,且父级无定位,则offsetParent是body
3. 如果父级有定位或者触发了haslayout=true,那么offsetParent是此父级