Javascript window loading masked embedded webpage content

Source: Internet
Author: User

Copy codeThe Code is as follows:
// Initialize the navigation background, iframe container
Function fnDaoHangBg ()
{
Var h = fnGetHeight (), w = fnGetWidth (); // obtain the background window size.
If (! $ ('Divdaohangbg '))
{
Var div = $ C ('div '); // create a background mask
Div. id = 'divdaohangbg ';
Div. style. backgroundColor = 'black ';
Div. style. position = 'absolute ';
Div. style. filter = 'Alpha (opacity = 80 )';
Div. style. opacity = '. 80 ';
Div. style. zIndex = 100001;
Div. style. left = 0;
Div. style. top = 0;
Div. style. width = w + 'px ';
Div. style. height = h + 'px ';
Document. body. appendChild (div );
}

If (! $ ('Divdaohangbgiframe '))
{
Var iframe;
Iframe = this. $ C ('iframe'); // create an embedded IFRAME container in the mask for embedding and displaying other webpages
Iframe. id = 'divdaohangbgiframe ';
Iframe. frameBorder = '0 ';
Iframe. scrolling = "no ";
Iframe. style. overflow = 'ddd ';
Iframe. allowTransparency = 'true ';
Iframe. style. display = 'none ';
Iframe. style. width = w + 'px '; // 800
Iframe. style. height = h + 'px '; // 620
Iframe. style. marginTop = '75px '; // 800
$ ('Divdaohangbg '). appendChild (iframe );
}
If (! $ ('Divdaohangbgclose '))
{
Var div = $ C ('div '); // create the close button on the mask.
Div. id = 'divdaohangbgclose ';
Div. style. position = 'absolute ';
Div. style. backgroundImage = 'url (images/closb.gif )';
Div. style. zIndex = 100003;
Div. style. right = 10;
Div. style. top = 20;
Div. style. width = '82px ';
Div. style. height = '30px ';
Div. title = 'close ';
Div. style. cursor = 'hand ';
Div. onclick = function () {// click Time to close the mask.
FnDaoHangBgClose ();
};
$ ('Divdaohangbg '). appendChild (div );
}
$ ('Divdaohangbgiframe'). style. display = 'block ';
$ ('Divdaohangbg '). style. display = 'block ';
}
// Close the mask
Function fnDaoHangBgClose ()
{
If (! $ ('Divdaohangbg ') {return ;}
If (! $ ('Divdaohangbgiframe') {return ;}
$ ('Divdaohangbgiframe'). src = '';
$ ('Divdaohangbgiframe'). style. display = 'none ';
$ ('Divdaohangbg '). style. display = 'none ';
}
// Call, embedded url
Function fnDaoHangBgShow (url)
{
FnDaoHangBg ();
$ ('Divdaohangbgiframe'). src = url;
}

$ () And $ C () represent
$ (Id), the object for obtaining this id, document. getElementById (id)
$ C (tag), create a tag, document. createElement (tag );

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.