Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavascriptÍÏ×§&ÍÏ·ÅϵÁÐÎÄÕÂ1Ö®offsetParentÊôÐÔ


Õâ¸öϵÁÐÎÄÕÂÖ÷ÒªÊǽ²ÊöʵÏÖJavascriptÍÏ×§¹¦ÄܵĻù´¡ÖªÊ¶£¬²¢½«ÔÚ×îºó¸ø³öÒ»¸öÍêÕûµÄʾÀý¡£Êʺ϶ÔÍÏ×§ÍêÈ«²»¶®µÄÈËÔĶÁ¡£
µÚһƪ¾ÍÏȽ²½²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. ²¢·Ç¹æ·¶µÄÒ»²¿·Ö.
 
²âÊÔ´úÂë1£º
<!DOCTYPE&nb


Ïà¹ØÎĵµ£º

javascriptÃæÏò¶ÔÏóÈ«ÐÂÀíÁ·(ËÄ)

ÀûÓÃÔ­Ðͼ̳еĹؼüÓÐÁ½²½²Ù×÷£º
Ê×ÏÈ´´½¨Ò»¸ö¸¸ÀàµÄʵÀý»¯¶ÔÏó£¬È»ºó½«¸Ã¶ÔÏ󸳸ø×ÓÀàµÄ prototype ÊôÐÔ¡£
ÕâÑù£¬¸¸ÀàÖеÄËùÓй«ÓÐʵÀý³ÉÔ±¶¼»á±»×ÓÀà¼Ì³Ð¡£²¢ÇÒÓà instanceof ÔËËã·ûÅжÏʱ£¬×ÓÀàµÄʵÀý»¯¶ÔÏó¼ÈÊôÓÚ×ÓÀ࣬ҲÊôÓÚ¸¸Àà¡£
È»ºó½«×ÓÀà±¾Éí¸³Öµ¸øËüµÄ prototype µÄ constructor ÊôÐÔ¡££¨×¢Ò⣺ÕâÀ︳ֵµÄʱº ......

javascript»ù´¡Ñ§Ï°£¨Î壩

ÀûÓõ÷Óü̳еĹؼüÖ»ÓÐÒ»²½²Ù×÷£º
¾ÍÊÇÔÚ×ÓÀඨÒåʱ£¬Í¨¹ý¸¸ÀàµÄ call ·½·¨£¬½«×ÓÀàµÄ this Ö¸Õë´«È롣ʹ¸¸Àà·½·¨ÔÚ×ÓÀàÉÏÏÂÎÄÖÐÖ´ÐС£
ÕâÑù£¬¸¸ÀàÖеÄËùÓÐÔÚ¸¸ÀàÄÚ²¿Í¨¹ý this ·½Ê½¶¨ÒåµÄ¹«ÓÐʵÀý³ÉÔ±¶¼»á±»×ÓÀà¼Ì³Ð¡£
Óà instanceof ÔËËã·ûÅжÏʱ£¬×ÓÀàµÄʵÀý»¯¶ÔÏóÖ»ÊôÓÚ×ÓÀ࣬²»ÊôÓÚ¸¸Àà¡£
²é¿´×ÓÀàµÄʵÀý»¯¶ÔÏóµÄ ......

ѧϰJavaScript£¨¶þ£©

6¡¢»ùÓÚ¶ÔÏóµÄJavaScriptÓïÑÔ
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄµÄÓïÑÔ£¬²»ÏñÃæÏò¶ÔÏóÓгéÏ󡢼̳С¢ÖØÔصÈÓйØÃæÏò¶ÔÏóµÄ¹¦ÄÜ£¬µ«ÊÇËü»¹ÊǾßÓÐÃæÏò¶ÔÏóµÄ»ù±¾ÌØÕ÷£¬Ëü¿ÉÒÔ¸ù¾ÝÐèÒª´´½¨×Ô¼ºµÄ¶ÔÏ󣬴Ӷø½øÒ»²½À©´óJavaScriptµÄÓ¦Ó÷¶Î§£¬ÔöÇ¿±àд¹¦ÄÜÇ¿´óµÄWebÎĵµ¡£
¶ÔÏóµÄ»ù´¡ÖªÊ¶£º
¶ÔÏóÊÇÓÉÊôÐԺͷ½·¨Á½¸ö»ù±¾ÔªËØ×é³É¡£Ò»¸ö¶Ô ......

JavaScriptÏû³ý×Ö·û´®¿Õ¸ñ

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js³ýÈ¥×Ö·û´®¿Õ¸ñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ