JS Select right

Source: Internet
Author: User

JavaScript gets object width and height

the width-height value of the label element gets // Absolute Width Obj.offsetwidth // Absolute Height Obj.offsetheight The following is a wide-height value that gets the Window object. ClientHeight   Gets the height of the object, does not calculate any margins, borders, scrollbars, but includes the object's padding. ClientLeft   gets   the distance between the Offsetleft property and the actual left side of the customer area. ClientTop   gets   the distance between the OffsetTop property and the actual top of the customer area. ClientWidth   Gets the width of the object, does not calculate any margins, borders, scrollbars, but includes the object's padding. ClientX   Sets or gets the x-coordinate of the position of the mouse pointer relative to the window client area   , where the customer area does not include controls and scroll bars for the window itself. ClientY   Sets or gets the y-coordinate of the position of the mouse pointer relative to the window's client area   , where the customer area does not include controls and scroll bars for the window itself. Clip   Sets or gets which part of the anchored object is visible. Clipbottom   Gets the bottom coordinate of the clipping area of the object. Clipleft   Gets the left coordinate of the clipping area of the object. Clipright   Gets the right coordinate of the object clipping area. Cliptop   gets the top-edge coordinates of the object clipping area. 
JS Gets the sibling of the node, parent, child element
<script>function dom () {vars= document.getElementById ("Test");d el_ff (s); //Clean Up SpacesvarChils= S.childnodes;//get all the child nodes of SvarPar=s.parentnode;//get the parent node of Svarns=s.nextsbiling;//get the next sibling node of Svarps=s.previoussbiling;//get the previous sibling node of SvarFc=s.firstchild;//get the first child node of SvarLc=s.lastchile;//get the last child node of S}</script>The following is a description of jquery's parent, child, and sibling node lookup method jquery.parent (expr) Find a Father node that can be passed into expr for filtering, such as $ ("span"). Parent () or $ ("span"). Parent (". Class"jquery.parents (expr), similar to jquery.parents (expr), but finds all ancestor elements, not limited to parent element Jquery.children (expr). Returns all child nodes, This method only returns the immediate child node and does not return all descendant nodes Jquery.contents (), returning all of the following content, including nodes and text. The difference between this method and children () is that including blank text, which is also returned as a jquery object, children () returns only the node Jquery.prev () and returns to the previous sibling node. Not all sibling nodes Jquery.prevall (), return all previous sibling nodes Jquery.next (), return to the next sibling node, not all sibling nodes Jquery.nextall (), Returns all subsequent sibling nodes jquery.siblings (), returning sibling nodes, Jquery.find (expr), completely different from jquery.filter (expr). Jquery.filter () is a partial filter from the initial set of JQuery objects, and the returned result of Jquery.find () does not have the contents of the initial collection, such as $ ("P"), Find ("span"), is to find <span&gt from the <p> element, which is equivalent to $ ("P span")
var first=document.getelementbytagname ("div") [0].children[0]

JS Select right

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.