JS pop-up layer source compatible with IE, FF, chrome__ compatible

Source: Internet
Author: User

function Showwin (O1,O2) {

var Mask=document.getelementbyid (O1);

var Popwin=document.getelementbyid (O2);

Document.documentElement.scrollHeight in IE, FF, Chrome is to get the full content of the Web page height
Document.documentElement.offsetHeight in IE is to obtain the inner surface of the clientheight (that is, a page does not include the printed debug information), in FF, Chrome to get the full content of the page height

Compatible with different browsers, get the height of the entire page

var maskheight=document.documentelement.offsetheight<document.documentelement.scrollheight? Document.documentElement.scrollHeight:documentElement.offsetHeight;

Let the shroud cover the entire page

mask.style.height=maskheight+ "px";

Document.documentElement.scrollTop in IE get the scroll bar after the top of the height of scrolling, under the chrome, FF get a height of 0
Document.body.scrollTop is zero under IE, Chrome, ff

Compatible with different browsers, the height of the scroll bar from the top

var top=document.body.scrolltop==0?document.documentelement.scrolltop:document.body.scrolltop;

Height of the pop-up layer from the top

popwin.style.top=260+top+ "px";

mask.style.display= "Block";

popwin.style.display= "Block";

}html code omitted

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.