Vertical Middle-layer JS operations CSS

Source: Internet
Author: User
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> // This must be added because IE8 xhtml4.0 does not support fixed if the height of the first layer exceeds the browser height, that is, imgdiv with a scroll bar, does not scroll with the scroll bar, it is always there <body id = "gn"> </body> <script language = "JavaScript"> function $ (titlename) {return document. createelement (titlename);} function $ (e) {return document. getelementbyid (E);} var lodingbox =$ $ ("Div"); lodingbox. style. position = "fixed"; lodingbox. style. width = screen. width + "PX"; lodingbox. style. height = screen. height + "PX"; lodingbox. style. backgroundcolor = "# cccccc"; lodingbox. id = "lodingbox"; var imgdiv =$ $ ("Div"); var imgdiv_width = "300"; var imgdiv_height = "100"; var imfdiv_left = screen. width-screen.width/2-imgdiv_width/2; // Why subtract 100px // I also don't know why it's calculated above high bottom low so I subtract 100 pxvar imfdiv_height = screen. height-screen.height/2-imgdiv_height/2-100; imgdiv. style. position = "fixed"; imgdiv. style. left = imfdiv_left + "PX"; imgdiv. style. top = imfdiv_height + "PX"; imgdiv. style. width = imgdiv_width + "PX"; imgdiv. style. height = imgdiv_height + "PX"; imgdiv. style. backgroundcolor = "red"; imgdiv. id = "imgdiv"; var lodingimg =$ $ ("IMG"); lodingimg. src = "loadingmin.gif"; var lodingtext =$ $ ("span"); lodingtext. innerhtml = "saving data. Please wait .... "; imgdiv. appendchild (lodingimg); imgdiv. appendchild (lodingtext); $ ("gn "). appendchild (lodingbox); $ ("gn "). appendchild (imgdiv); var temp = 1; zheli (10); // $ ("lodingbox "). style. display = "NONE"; // $ ("imgdiv "). style. display = "NONE"; function zheli (n) {If (n = 1) {return temp;} temp = temp * n; // document. write (temp + "<br/>"); // recursive zheli (n-1) ;}</SCRIPT>

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.