Hide and display JavaScript layers and control their display positions

Source: Internet
Author: User

<P> <br/> <center> <br/> <a href = "#" mce_href = "#" Title = "adsf <br/> adsfdddddddddddd <br/> asdffffffffffd </P> <p> commandid was too large <br/>{/ $/} <br/> (OO )) <br/> zookeeper transaction execution <br/>{/ $/} <br/> (OO )) <br/> test </a> <br/> </center> <br/> </P> <br/> <Div align = "Center "> <br/> hide and display layers and control their display positions <br/> </P> <p> </div> <br/> <p align = "center"> <br/> <br/> <Map Name =" map1 "id =" map1 "> <br/> <area shape =" rect "mce_shape = "rect" id = "area1" coords = "2,64, 117,107 "mce_coords =" 117,107, "href =" # "mce_href =" # "onmouseover =" showorhidediv (1, 'd1 ', 'img1', 'area 1 ') "onmouseout =" showorhidediv (0, 'd1', 'img1', 'area1 ') "/> <br/> <area shape =" rect "mce_shape =" rect "id =" area2 "coords =" 2,139,158,183 "mce_coords =" 2,139,158,183 "href =" # "mce_href = "#" onmouseover = "showorhidediv (1, 'd2 ', 'img1', 'area2') "onmouseout =" showorhidediv (0, 'd2 ', 'img1', 'area2 ') "/> <br/> <area shape =" rect "mce_shape =" rect "id =" area3 "coords =" 37,3, 158,46 "mce_coords =" 37,3, 158-46 "href =" # "mce_h Ref = "#" onmouseover = "showorhidediv (1, 'd3 ', 'img1', 'area3')" onmouseout = "showorhidediv (0, 'd3 ', 'img1 ', 'area3 ') "/> <br/> </map> <br/> <Div id =" d1 "style =" display: none; position: absolute; z-indexes: 10000; "mce_style =" display: none; position: absolute; Z-index: 10000; "> <br/> <Table align =" center "> <tr> <TD style =" border: solid 1px red; Background-color: # ff99ff "mce_style =" border: solid 1px red; Background-color :# Ff99ff "> <br/> <br/> </TD> </tr> </ table> <br/> </div> </P> <p> <Div id = "D2" style = "display: none; position: absolute; Z-index: 10000; "mce_style =" display: none; position: absolute; Z-index: 10000; "> <br/> <Table align =" center "width =" 200 "> <tr> <TD style =" border: solid 1px Red; Background-color: # ffffaa; "mce_style =" border: solid 1px red; Background-color: # ffffaa; "> <br/> allowdrop <br/> gets or sets a value that indicates whether the control can accept the data dragged to it by the user. <Br/> </TD> </tr> </table> <br/> </div> </P> <p> <div id = "D3" style = "display: none; position: absolute; Z-index: 10000; "mce_style =" display: none; position: absolute; Z-index: 10000; "> <br/> <Table align =" center "width =" 200 "> <tr> <TD style =" border: solid 1px red; Background-color: # ffffcc "mce_style =" border: solid 1px red; Background-color: # ffffcc "> <br/> anchor <br/> get or set the edge of the container to which the control is bound and determine how the control Adjust the size of the parent node together. <Br/> </TD> </tr> </table> <br/> </div> <br/> </P> <br/> <MCE: script Type = "text/JavaScript"> <! -- <Br/> function showorhidediv (sign, divid, imgid, areaid) <br/>{< br/> var objimgid = document. getelementbyid (imgid); <br/> var objareaid = document. getelementbyid (areaid); <br/> var objdiv = document. getelementbyid (divid); <br/> objdiv. style. left = objimgid. offsetleft + objareaid. offsetleft + objareaid. offsetwidth * 9/10; <br/> objdiv. style. top = objimgid. offsettop + objareaid. offsettop + objareaid. offsetheight/2; </P> <p> If (Sign = 1) <br/> objdiv. style. display = ""; <br/> else <br/> objdiv. style. display = "NONE"; <br/>}< br/> // --> </MCE: SCRIPT>

 

A few other meanings of width and height are provided:

 

Visible area width of the webpage: Document. Body. clientwidth;
Visible area height: Document. Body. clientheight;
Visible area width of the webpage: Document. Body. offsetwidth (including the width of the edge );
Visible area height of the webpage: Document. Body. offsetheight (including the width of the edge );
Full text width of the webpage: Document. Body. scrollwidth;
Webpage text height: Document. Body. scrollheight;
The height of the page to be rolled: Document. Body. scrolltop;
Left of the webpage to be rolled: Document. Body. scrollleft;
Page body: window. screentop;
Page body part left: window. screenleft;
Screen Resolution Height: window. Screen. height;
Screen Resolution width: window. Screen. width;
Available screen workspace Height: window. Screen. availheight;
Available screen workspace width: window. Screen. availwidth;
Screen available workspace width: window. Screen. availwidth;

Scrollheight: gets the scroll height of an object.
Scrollleft: sets or obtains the distance between the left-side border of the object and the leftmost end of the currently visible content in the window.
Scrolltop: sets or obtains the distance between the top of the object and the top of the visible content in the window.
Scrollwidth: gets the scroll width of an object.
Offsetheight: gets the height of an object relative to the layout or the parent coordinate specified by the parent coordinate offsetparent attribute.
Offsetleft: obtains the left position of the object relative to the layout or the parent coordinate specified by the offsetparent attribute.
Offsettop: obtains the top position of an object relative to the layout or the parent coordinate specified by the offsettop attribute.
The horizontal coordinates of event. clientx relative to the document
The vertical coordinates of event. clienty relative to the document
Horizontal coordinates of event. offsetx relative to the container
Event. offsety vertical coordinates of the container
Document.doc umentelement. scrolltop vertical scroll Value
Event.clientxw.document.doc umentelement. The horizontal coordinate of scrolltop relative to the document + The amount of vertical scrolling
The difference between Firefox and IE is as follows:
Ie6.0, ff1.06 +:
Clientwidth = width + padding
Clientheight = height + padding
Offsetwidth = width + padding + border
Offsetheight = height + padding + border
Ie5.0/5.5:
Clientwidth = width-border

Related Article

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.