DOM element operation additions and deletions change

Source: Internet
Author: User
Get Web page width high var sheight=document.documentelement.scrollheight;var swidth=document.documentelement.scrollwidth;// Get the viewable area wide-height var wheight=document.documentelement.clientheight;var wwidth=document.documentelement.clientwidth;// Create Divvar omask=document.createelement ("div"); omask.id= "Mask"; omask.style.height=sheight+ "px"; omask.style.width= swidth+ "px";d ocument.body.appendChild (Omask);//Create Divvar ologin=document.createelement ("div"); ologin.id= "Login" ; ologin.innerhtml= "<div class= ' Logincon ' ><div id= ' close ' ></div></div>"; Document.body.appendChild (Ologin);//Gets the DOM element's wide-height var dheight=ologin.offsetheight;var dwidth=ologin.offsetwidth;o login.style.left= (wwidth-dwidth)/2+ "px"; ologin.style.top= (wheight-dheight)/2+ "px";

  

Delete element Document.body.removeChild (omask);d ocument.body.removeChild (Ologin);

  

DOM element operation additions and deletions change

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.